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

Move the PHP function ezcontentobjecttreenodeoperations::move to ezcontentoperationcollection::move #58

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pkamps
Copy link
Member

@pkamps pkamps commented May 17, 2017

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:

  1. eZContentObjectTreeNode::move - https://github.com/mugoweb/ezpublish-legacy/blob/master/kernel/classes/ezcontentobjecttreenode.php#L4238
  2. eZContentOperationCollection::moveNode - https://github.com/mugoweb/ezpublish-legacy/blob/master/kernel/content/ezcontentoperationcollection.php#L727
  3. eZContentObjectTreeNodeOperations::move - https://github.com/mugoweb/ezpublish-legacy/blob/master/kernel/classes/ezcontentobjecttreenodeoperations.php#L45

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:

  1. fixing reverse relations
  2. re-indexing the node

Now it is the opposite: eZContentObjectTreeNodeOperations::move is now only a deprecated wrapper. All actual code to move a node is in eZContentOperationCollection::moveNode.

@pkamps pkamps added this to the Backlog milestone May 28, 2019
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

Successfully merging this pull request may close these issues.

1 participant