-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Admin embedded collection seems to remove entities with by_reference=false #6564
Admin embedded collection seems to remove entities with by_reference=false #6564
Comments
Thanks for the report @yann-eugone. It's working in 3.77. The But it seems that changing the So it's maybe better to provide a Then a PR would be neede here: https://github.com/sonata-project/SonataDoctrineORMAdminBundle/blob/3.x/src/Builder/FormContractor.php#L227
I currently don't see another solution. |
Thanks for this very quick answer @VincentLanglet :) Looks like you were right : downgrading to I tried to figure out which was the impacts of
Maybe it is just me not undserstanding how this works, but it can't see what part of the code produced between 3.77.0 & 3.78.1 is messing the whole thing up... |
Since 3.78 we pass the And then, the persistence bundle send back And the bug occur because of
|
Disclaimer : This is a really weird bug for which I had some bad time understanding why this is happening. Explanation might not be as clear as possible. But I'm fully available fore more information/demo.
Environment
Sonata packages
Symfony packages
PHP version
Subject
When you embed a collection of admin, using
CollectionType
& settingby_reference=false
option.All entries in collection are removed and re-created as new objects.
Steps to reproduce
I've created a sample project, with minimal code/dependencies : https://github.com/yann-eugone/sonata-collection-error.
In this project, I've added a
UniqueEntity
constraint onto Experience entity, in order to highlight the issue.If you create a
Person
entity, with 1Experience
, and if you press Update right after object creation you will have the following error :Expected results
Collection entries should be preserved.
Actual results
Collection entries are removed and re-created.
Further investigations
I've spent some time debugging why/where/when this is happening. Had some times in the property path classes, but not sure if this is the place to look.
I tested this behavior in a Symfony only project, and this behavior is not reproduced.
This is why i've opened this issue here.
I've also tried to downgrade my demo project to a lower version of sonata, but I also has to downgrade symfony : on the sonata highest version allowed with symfony 4.3, the issue is not reproduced either.
The text was updated successfully, but these errors were encountered: