本文整理汇总了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);
}
}
}