Cookbook
The following are some of the use cases of decorating Doctrine collections.
Use Cases
Type Safety
We can use collection decoration to ensure that the items in a collection are of
Record Precounting
Database servers can be [slow in counting
Selectable Abstraction
Doctrine ORM uses collection objects that also implement the Selectable
Decorating Member Objects
We can use a collection decorator to dynamically decorate the members of the
Loading Prevention in Extra Lazy Collections
Suppose you have an entity that has a one-to-many relation with a million
Lazy Chained Matching
If you call matching() on a PersistentCollection, it will immediately query