mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-2667: Collections for OneToMany&ManyToMany relations generated by entity's repository #3346
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Sep 10, 2013).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user morgen:
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") **/
private $persons;
Advantages
Problems
@beberlei commented on GitHub (Feb 18, 2020):
The solution here is to call
$personRepository->findAllowedPersonsBy($other)yourself in your code.