-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
Changing the name of a node results in deletion not move #659
Comments
i guess we should not add the empty reordering, it makes no sense. but for when other changes do exist, we have to sort out the ordering issue then. |
The setup to demonstrate this seems a bit more complicated than I thought ... |
So this UOW is moving the node, then recalculating the changeset, and then registering a delete for the "missing" node and then deleting it because
|
This is a bit more complicated, see the test in #661. |
possible fix for issue doctrine#659 fix cs
Just bumped into that again. I think I will test my change in #661 in production now ... |
if you find a way to get the build green on #661 and have an improvement
that has no regressions, i am happy to merge that pull request. even if
it does not fix all problems around the topic - re-reading it i feel
like we got lost in the realm of possible fixes and improvements.
|
As already mentioned in #661 there remains an issue with undoing an reordering of children in preUpdate which keeps the tests failing. If I find the time I will investigate that again. |
(cherry picked from commit a338384)
I found this while trying to rename a route (from the RoutingBundle) with setName, the cause is a bit difficult to describe ...
First you need a parent with mapped children, say /cms/routes/zn, the child /cms/routes/zn/page-1 will be renamed to page-2 with setName.
The UnitOfWork correctly detects the move of /cms/routes/zn/page-1 to /cms/routes/zn/page-2. But it also creates a change for /cms/routes/zn because it adds an empty reordering in https://github.com/doctrine/phpcr-odm/blob/master/lib/Doctrine/ODM/PHPCR/UnitOfWork.php#L1422 or https://github.com/doctrine/phpcr-odm/blob/master/lib/Doctrine/ODM/PHPCR/UnitOfWork.php#L1424. the resulting executeUpdates for /cms/routes/zn triggers another computeChangeset for that node in https://github.com/doctrine/phpcr-odm/blob/master/lib/Doctrine/ODM/PHPCR/UnitOfWork.php#L2482, which then results in a deletion of /cms/routes/zn/page-1.
Only adding the reodering if the array in https://github.com/doctrine/phpcr-odm/blob/master/lib/Doctrine/ODM/PHPCR/UnitOfWork.php#L1420 has count > 0 solves that very special case for me but if your parent node has other changes it will break anyway.
Hope this is somehow clear ...
Cheers
Uwe
The text was updated successfully, but these errors were encountered: