You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Users regularly want to introduce their own collections. We don't want to expose the Collection interface due to its complexity there is too much risk. MongoDB ODM has a code generated solution for this, for ORM I propose we do this with delegation.
doctrine/collections introduces a DelegateCollection with all methods implemented as final, delegating to $delegatee, and one custom method getInternalDelgatee.
In ORM association configuration, allow optional "collectionType" information. When present, ORM converts with logic:
create collection new $assoc['collectionType](new PersistentCollection(...)) everywhere a PersistentCollection is created.
Users regularly want to introduce their own collections. We don't want to expose the Collection interface due to its complexity there is too much risk. MongoDB ODM has a code generated solution for this, for ORM I propose we do this with delegation.
DelegateCollection
with all methods implemented as final, delegating to $delegatee, and one custom methodgetInternalDelgatee
.new $assoc['collectionType](new PersistentCollection(...))
everywhere a PersistentCollection is created.$col = $col instanceof DelegateeCollection ? $col->getDelegatee() : $col
collectionType
key automatically.Example code:
Reference:
The text was updated successfully, but these errors were encountered: