jackalope/jackalope — pull request #125 by petesiss (2012-06-24 12:32:25+00:00)
Title: Multiple operations fail because nodes originalNodesOrder is out of sync

The nodes ``getOrderCommands()`` relies on comparing ``originalNodesOrder`` (which is set when a sessions first reorder operation happens) with the current state as found in the nodes ``getNodes()``.

If the state of the tree is changed due to nodes being added, removed, or moved, in between reorder and saving the session, then things can go wrong as originalNodesOrder has the wrong number of elements, and unexpected elements / missing elements.

Because the reorder operation is the last operation in object managers sync, then as long as we keep the correct originalNodesOrder elements in sync with the adds and deletes, the reorder can then work as it should.

The new test in phpcr-api-tests pr 69 (https://github.com/phpcr/phpcr-api-tests/pull/69) passes with this PR.