-
Notifications
You must be signed in to change notification settings - Fork 60
A node must keep its position relative to its siblings when being renamed #262
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
Conversation
@@ -471,6 +475,9 @@ public function rename($newName) | |||
} | |||
|
|||
$this->session->move($this->path, $newPath); | |||
if ($next) { | |||
$this->getParent()->orderBefore($newName, $next); | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is maybe not the most elegant way of solving this, but the impact is low and i see rename as a shortcut for this operation anyways. and lacking native support in the transport layer, this would just end up the same way if we would add an internal method that unifies move and rename. (Session::move does a couple of important checks to avoid name collisions).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this doesn't cause issues when doing a rename and an explicit move in the same transaction?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lsmith77 it shouldn't do surely as we are simply using the session API here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if there is a problem, it would also occur when i do orderBefore and then move the node. but i think with the activity log we now have, it should work out.
A node must keep its position relative to its siblings when being renamed
for the record, this should actually be handled inside the transport layer to ensure that the most efficient strategy is used to handle this .. but lets keep this for 2.0 (it was added to the todo list there) |
@dbu was this reverted? |
not that i would be aware of. did the code disapear from master? |
no sorry, my mistake. Its fine :) I had git log confusion. |
@dbu Nope..all good. |
Fix #255
Test added in phpcr/phpcr-api-tests#144