Normalize hasMany polymorphic types. Fixes #1338

I am not at all happy with the nested if's going on here.