當前位置: 首頁>>代碼示例>>PHP>>正文


PHP eZContentObjectTrashNode::createFromNode方法代碼示例

本文整理匯總了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);
         }
     }
 }
開發者ID:brookinsconsulting,項目名稱:ezecosystem,代碼行數:48,代碼來源:ezcontentobjecttreenode.php


注:本文中的eZContentObjectTrashNode::createFromNode方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。