SensioFrameworkExtraBundle icon indicating copy to clipboard operation
SensioFrameworkExtraBundle copied to clipboard

[DoctrineParamConverter] False positive matches from ManyToOne relationship

Open theMadness opened this issue 8 years ago • 1 comments

I have a route with Entity1 in a OneToMany with Entity2, the DoctrineParamConverter is automatically filling Entity2 whenever Entity1 is present, by picking the first available Entity2 that's related to Entity1.

I think the issue is in the findOneBy method, it checks for isSingleValuedAssociation which gives a false positive in the described situation.

Not sure about fixes for this one, maybe instead of using findOneBy we could run a find and not return anything in case of multiple finds.

theMadness avatar Dec 07 '17 01:12 theMadness

I know this issue is old, but if still relevant: if this really gives a false positive then it's a bug in the Doctrine ORM.

Also what does your annotation look like, specially the "mapping" option? Without the mapping option present it would not be called and the issue must be somewhere else.

mdeboer avatar May 14 '18 12:05 mdeboer