Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

repositoryMethod for ReferenceOne #399

Closed
bazo opened this issue Aug 28, 2012 · 5 comments
Closed

repositoryMethod for ReferenceOne #399

bazo opened this issue Aug 28, 2012 · 5 comments

Comments

@bazo
Copy link

bazo commented Aug 28, 2012

hi,

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") */   
$defaultCar,    

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

@jwage
Copy link
Member

jwage commented Oct 11, 2012

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

@bazo
Copy link
Author

bazo commented Oct 11, 2012

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

@ephrin
Copy link

ephrin commented Apr 25, 2014

+1

@wodka
Copy link
Contributor

wodka commented Apr 7, 2015

This feature would be really helpful (http://stackoverflow.com/questions/29492965/doctrine2-how-to-handle-missing-relation-documents/29494298)

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

@alcaeus
Copy link
Member

alcaeus commented Dec 22, 2017

I'm going to close this in favor of #1397. Lazy-loading referenceOne mappings would allow using repositoryMethod for those as well, as loading the document is deferred until it's actually used.

@alcaeus alcaeus closed this as completed Dec 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants