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

GH11551 - fix OneToManyPersister::deleteEntityCollection case where single-inheritence table parent entity is targetEntity. #11564

Conversation

gitbugr
Copy link
Contributor

@gitbugr gitbugr commented Aug 3, 2024

Fixes #11551

When using the parent entity for a single-inheritence table as the targetEntity for a property, the discriminator value should be all of the values in the discriminator map.

OneToManyPersister::deleteEntityCollection has been amended to reflect this.

single-inheritence entity parent as targetEntity.

When using the parent entity for a single-inheritence table as the
targetEntity for a property, the discriminator value should be all
of the values in the discriminator map.
OneToManyPersister::deleteEntityCollection has been amended to
reflect this.
@gitbugr gitbugr changed the title GH11551 - fix OneToManyPersister::deleteEntityCollection case where single-inheritence table parent enitty is targetEntity. GH11551 - fix OneToManyPersister::deleteEntityCollection case where single-inheritence table parent entity is targetEntity. Aug 3, 2024
$em->persist($testEntityHolder);
$em->flush();

$testEntityHolder->testEntities = new ArrayCollection();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, you are only changing the inverse side of the relationship, right? With that in mind, and after reading this, I don't see why "All records should have been deleted". Am I missing something?

Copy link
Contributor Author

@gitbugr gitbugr Aug 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe.. unless I'm misunderstanding, I think that linked page is incomplete as it doesn't account for orphanRemoval. This suggests in that case the inverse side is not ignored?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like you're correct. Maybe that first page should be updated to account for that exception to the general rule?

Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>
@greg0ire greg0ire merged commit 8ac6a13 into doctrine:2.19.x Aug 5, 2024
58 checks passed
@greg0ire greg0ire added this to the 2.19.7 milestone Aug 5, 2024
@greg0ire
Copy link
Member

greg0ire commented Aug 5, 2024

Thanks @gitbugr !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants