Move the PHP function ezcontentobjecttreenodeoperations::move to ezcontentoperationcollection::move #58
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request is not fixing a bug. It's moving code to make the ezp API a little more consistent.
There a 3 PHP functions to move a node:
For 1)
eZContentObjectTreeNode extends eZPersistentObject. Its main purpose is to update the DB related entries if you move a node.
For 2)
This function is a wrapper to eZContentObjectTreeNode::move: it internally calls eZContentObjectTreeNode::move but does extra stuff like clearing cache, updating the search index, logging to the audit log etc etc. Basically a higher level of the ezp API.
For 3)
I think that function should not exists. It is pretty much the same as 2) but in another class. This class only contains a single function 'move'. It was developed in context of the WebDAV integration:
https://github.com/bernhard-roessler/ezpublish-legacy/blame/f1d42b6facfbef92fbc7114a4fc5e45a7d4f6565/kernel/classes/ezcontentobjecttreenodeoperations.php
For an API consumer, it would be simpler if there is only 1) and 2) and not that extra wrapper function described in 3).
I resolve this problem by marking 3) as deprecated. Internally, the function is calling eZContentOperationCollection::moveNode.
My code changes
You will see that eZContentOperationCollection::moveNode used to call eZContentObjectTreeNodeOperations::move. The heavy lifting happened in eZContentObjectTreeNodeOperations::move. eZContentOperationCollection::moveNode was only a wrapper function doing 2 extra things:
Now it is the opposite: eZContentObjectTreeNodeOperations::move is now only a deprecated wrapper. All actual code to move a node is in eZContentOperationCollection::moveNode.