The ArrayCollection object for OneToMany or ManyToMany relations is
generated by Doctrine. There is no ability within entity to get acces to it's repository.
This would be very useful nice to specify additionally the method in entity's repository, which could generate collection for the given entity.
An example annotation
/** @ORM\OneToMany(targetEntity="Person", repositoryMethod="findAllowedPersons") */
- optimized query for collection (or even php script)
- generation of collections can depends on external parameters or internal fields
- for such collections adding/removing of elements is not allowed or has be limited