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

Update ObjectHydrator.php #11235

Open
wants to merge 8 commits into
base: 2.19.x
Choose a base branch
from
Open

Update ObjectHydrator.php #11235

wants to merge 8 commits into from

Conversation

eltharin
Copy link

@eltharin eltharin commented Feb 7, 2024

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

correction for bug when multiple calls
@derrabus
Copy link
Member

derrabus commented Feb 8, 2024

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.

@eltharin
Copy link
Author

eltharin commented Feb 8, 2024

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...

@eltharin
Copy link
Author

eltharin commented Feb 8, 2024

error

@greg0ire
Copy link
Member

Emphasis is mine:

Please start by providing a functional test that fails without your changes.

@eltharin
Copy link
Author

I Hope test is OK for you, I didn't know where I Can put the entity classes.

@derrabus derrabus changed the base branch from 2.18.x to 2.19.x March 13, 2024 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants