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

When trying to delete multiple nodes, every other node does not get deleted #22

Open
steven-mercatante opened this issue Jan 24, 2013 · 1 comment

Comments

@steven-mercatante
Copy link

Say you fetch five entities from the DB, and want to delete each one. Iterate over the collection, wrapping each entity as a node, and then call $node->delete(). Only some of the nodes will be deleted, and the pattern seems to be that every other entity is not deleted. So, if you tried deleting the five entities, the second and fourth entities would not be deleted.

Looking at NodeWrapper::delete(), if you output the result of $qb->getQuery()->execute() (line 1182) you'll get back 0 for every other query.

@steven-mercatante
Copy link
Author

After more testing, it looks like the following three lines within NodeWrapper::delete() are somehow responsible:

$first = $oldRgt + 1;
$delta = $oldLft - $oldRgt - 1;
$this->shiftRLRange($first, 0, $delta, $oldRoot);

I was able to work around the issue by reversing my original array of entities, so that the ones with higher rgt values were processed before those whose rgt values were lower.

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