本文整理匯總了PHP中eZContentObjectTrashNode::createFromNode方法的典型用法代碼示例。如果您正苦於以下問題:PHP eZContentObjectTrashNode::createFromNode方法的具體用法?PHP eZContentObjectTrashNode::createFromNode怎麽用?PHP eZContentObjectTrashNode::createFromNode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類eZContentObjectTrashNode
的用法示例。
在下文中一共展示了eZContentObjectTrashNode::createFromNode方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: removeNodeFromTree
function removeNodeFromTree($moveToTrash = true)
{
$nodeID = $this->attribute('node_id');
$object = $this->object();
$assignedNodes = $object->attribute('assigned_nodes');
if ($nodeID == $this->attribute('main_node_id')) {
if (count($assignedNodes) > 1) {
$newMainNode = false;
foreach ($assignedNodes as $assignedNode) {
$assignedNodeID = $assignedNode->attribute('node_id');
if ($assignedNodeID == $nodeID) {
continue;
}
$newMainNode = $assignedNode;
break;
}
// We need to change the main node ID before we remove the current node
$db = eZDB::instance();
$db->begin();
eZContentObjectTreeNode::updateMainNodeID($newMainNode->attribute('node_id'), $object->attribute('id'), $object->attribute('current_version'), $newMainNode->attribute('parent_node_id'));
$this->removeThis();
eZSearch::addObject($object);
$db->commit();
} else {
// This is the last assignment so we remove the object too
$db = eZDB::instance();
$db->begin();
$this->removeThis();
if ($moveToTrash) {
// saving information about this node in ..trash_node table
$trashNode = eZContentObjectTrashNode::createFromNode($this);
$db = eZDB::instance();
$db->begin();
$trashNode->storeToTrash();
$db->commit();
$object->removeThis();
} else {
$object->purge();
}
$db->commit();
}
} else {
$this->removeThis();
if (count($assignedNodes) > 1) {
eZSearch::addObject($object);
}
}
}