setRemoved() public method

Enables using the remove method when only setters are available
public setRemoved ( boolean $removed ) : void
$removed boolean If TRUE, this node and it's child nodes will be removed. This can handle FALSE as well.
return void
示例#1
0
 /**
  * Enables using the remove method when only setters are available
  *
  * @param boolean $removed If TRUE, this node and it's child nodes will be removed. If it is FALSE only this node will be restored.
  * @return void
  * @api
  */
 public function setRemoved($removed)
 {
     if (!$this->isNodeDataMatchingContext()) {
         $this->materializeNodeData();
     }
     if ((bool) $removed === true) {
         /** @var $childNode Node */
         foreach ($this->getChildNodes() as $childNode) {
             $childNode->setRemoved(true);
         }
         $this->nodeData->setRemoved(true);
         $this->emitNodeRemoved($this);
     } else {
         $this->nodeData->setRemoved(false);
         $this->emitNodeUpdated($this);
     }
     $this->context->getFirstLevelNodeCache()->flush();
 }
 /**
  * Remove the given node
  *
  * @param NodeData $node
  * @return void
  */
 public function execute(NodeData $node)
 {
     $node->setRemoved(true);
 }