orm
orm copied to clipboard
Update ObjectHydrator.php
correction for bug when multiple calls :
when I automaticly made a DQL like :
return $this
->createQueryBuilder('s0_')
->leftJoin('s0_.itemSeries','i1_')->addSelect('i1_')
->leftJoin('i1_.item','i2_')->addSelect('i2_')
->leftJoin('s0_.serieImportators','s4_')->addSelect('s4_')
->leftJoin('s4_.serie','s5_')->addSelect('s5_')
->leftJoin('s5_.itemSeries','i6_')->addSelect('i6_')
ItemSerie Entity :
class ItemSerie
{
#[ORM\Id]
#[ORM\ManyToOne( inversedBy: 'itemSeries')]
#[ORM\JoinColumn(nullable: false)]
private ?Item $item = null;
#[ORM\Id]
#[ORM\ManyToOne( inversedBy: 'itemSeries')]
#[ORM\JoinColumn(nullable: false)]
private ?Serie $serie = null;
#[ORM\Column(type: 'string', length: 50)]
private $numero;
...
}
on each series, the last itemSeries has the good number but the item witch is associate is bad, it take the second of list
Sorry, I don't understand the problem that you're trying to fix here. Please start by providing a functional test that fails without your changes. That might help others understand and it also helps preventing future regressions.
here is a repo for reproduce the error : https://github.com/eltharin/errordoctrine/ don't know why but sometimes when changing some values, all become good...
Emphasis is mine:
Please start by providing a functional test that fails without your changes.
I Hope test is OK for you, I didn't know where I Can put the entity classes.
Is there something to do more ?
Getting a green build perhaps?
Yes... but I can(t correct all of your errors, my change appear as error with PSALM but indexof want mixed argument and I give object... and all unit test failed without reason
Other one is good :)