Fix fatal errors on _joinData

Fix fatal errors caused by un marshalled _joinData properties. The BelongsToMany association was assuming that this property would always contain an entity, which it doesn't.

I have also updated the associations to typehint against the interface instead of the concrete type.

Refs #5130
I thought about doing that, but it adds more secret marshalling. If the user explicitly didn't marshall the `_joinData` then we shouldn't be persisting it.