Datamapper
Datamapper copied to clipboard
Revise relationship storage
The current DataMapper version stores relationship information in the configuration of the model.
This means that to find all data of a relationship, the related model must be instantiated to get access to the relationship definition from the other side.
It would be better if these would be stored in a single relationship definition "table" defining the model-pairs that make up the definition of the relation. This would mean a lot less object instantiations, and better relationship validation.
It would only be an improvement though if the model definitions are cached, otherwise the setup would always have to instantiate all related models, even if they are not referenced.