|
Monday 04 July 2005 1:45:08 am
Comment40879
Hi, I have also struggled alot with trying to get the $node->move($to_node_id) to work.. I managed to get it to move the object to a new node, but after moving a node with it, the moved node changes node id everytime i republish it. Searched on the forums, found someone else with the same problem, but no solution.. myabe a bug in Exponential? The code I use to move my objects to a new node is the following:
$object =& eZContentObject::fetch( $objectID );
$nodeID =& $object->attribute('main_node_id');
$version =& $object->currentVersion();
$versionNumber =& $version->attribute('version');
$nodeAssignments = $version->nodeAssignments();
eZContentObjectTreeNode::remove($nodeID);
$version->removeAssignment($newNodeID);
$version->assignToNode($newNodeID, 1, 0);
$version->store();
include_once( 'lib/ezutils/classes/ezoperationhandler.php' );
$operationResult = eZOperationHandler::execute( 'content', 'publish', array( 'object_id' => $objectID, 'version' => $versionNumber ) );
Where ObjectID is the object to be moved and newNodeID is the new Node that it is going to be assigned to.. //Ralph
Contactivity B.V.
http://www.contactivity.com
|