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

Cloning or populating lazy-loaded entity with nullified id has unexpected behavior #11417

Open
AntoineRoue opened this issue Apr 18, 2024 · 0 comments

Comments

@AntoineRoue
Copy link

Bug Report

Q A
BC Break no
Version 3.1.2

Summary

Cloning a lazy-loaded entity or populating it after setting its id to null does not work properly.

Current behavior

When we do $entity->getEntityB(), B entity is lazy loaded. Then, if we set B entity's id to null before to populate it, and then we populate it, it populates the first B entity of the database, the one inserted first in the database.

If we clone a lazy loaded entity, persist and flush it, properties are nullified.

How to reproduce

I created a minimal repository whith these bugs here : https://github.com/AntoineRoue/doctrine-test

Expected behavior

In my opinion, a lazy-loaded entity should be populated just before its id is set to null or it's cloned.

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

No branches or pull requests

1 participant