Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

repositoryMethod for ReferenceOne #399

Open
bazo opened this Issue · 4 comments

5 participants

@bazo

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
Owner

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

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

@wodka

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.