I'm fetching data with a many-to-many relationship and I want to define acustom method. Is it possible (and how) to use something like:
$hotel = $entityManager->getRepository('Hotels')->findOneById(1);
$types = $hotel->getTypes(); //$types is instance of **Doctrine\ORM\PersistentCollection**
$types->myCustomFunction(); //do something
It seems to be not implemented already.
See this Doctrine's JIRA issue : http://www.doctrine-project.org/jira/browse/DDC-547
Consider allowing custom PersistentCollection implementations
We should consider allowing the configuration of custom PersistentCollection implementations on a per-association basis.
This could allow users to craft optimized (SQL) behavior for for some of their collections to improve performance without changing the domain model code.
For this, PersistentCollection needs to be designed for inheritance.