repositoryMethod for ReferenceOne #399

bazo opened this Issue Aug 28, 2012 · 4 comments

5 participants



odm doesnt support repositoryMethod for ReferenceOne annotation. i just recently found out about these repository methods and find them very useful.

but i am disappointed that it doesnt work with reference one.

use case:

user has many cars, but only one default. so i would like to do

/** @ODM\ReferenceMany(targetDocument="Car", repositoryMethod="getDefaultCar") */   

of course i can work around it by annotating it with reference many but that is not true. could this be added?

Doctrine member

I don't think this is a desired functionality because it would require us to eagerly hydrate the value for $defaultCart by calling getDefaultCar.


I can't see a problem in that. When i call getDefaultCar() i expect to get an object anyway




This feature would be really helpful (

In the annotation definition I can already define a repositoryMethod, but it is never called

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment