Details
-
Bug
-
Resolution: Obsolete
-
Medium
-
None
-
4.3.0
-
None
Description
Summary is self explanatory
Have a look at 'steps to reproduce'
Steps to reproduce
Hi
I wanted to delete at once (or move to trash according to user's wish) an object having several locations
(http://share.ez.no/forums/developer/delete-an-object-move-it-to-trash-that-has-several-locations)
So, as ActionRemove in kernel/content/action.php doesn't support the feature of indicating many contentNode to delete, I've added some line of codes in it around line 1230 to test if it could work (I could then code a new action in my extension)
in kernel/content/action.php, after:
if ( $object instanceof eZContentObject )
I've added:
// HACK
// DOESN'T work, it doesn't work if DeleteIDArray contains the main node...
if ( $http->hasPostVariable( 'CompleteRemove' ) )
{
// Looking for all nodes of this object
$publishedAssignedID = array();
$publishedAssigned = $object->assignedNodes( false );
foreach ( $publishedAssigned as $element )
$http->setSessionVariable( 'DeleteIDArray', $publishedAssignedID );
}
// END OF HACK
But then I get a php error:
Call to a member function attribute() on a non-object in kernel/content/ezcontentoperationcollection.php on line 951
In fact at these lines:
$allNodes = $objectIdList[$objectId]->assignedNodes();
// Registering node that will be promoted as 'main'
$mainNodeChanged[$objectId] = $allNodes[0];
eZContentObjectTreeNode::updateMainNodeID( $allNodes[0]>attribute( 'node_id' ), $objectId, false, $allNodes[0]>attribute( 'parent_node_id' ) );
$allNodes is empty, therefore this php error
Afterwards, if I add a check:
if (!empty($allNodes))
Then all work well, my object has been deleted, every node deleted.
But the problem is that I don't have the choice anymore, object isn't put into trash (removeobject doesn't ask me confirmation to move to trash), object is completely deleted...
Hope this helps
Attachments
Issue Links
- relates to
-
EZP-18871 when removing an object with two locations, ez does not ask to send to trash but always does real deletion
- Open