コード例 #1
0
 /**
  * Remove all properties not configured in the current Node Type.
  * This will not do anything on Nodes marked as removed as those could be queued up for deletion
  * which contradicts updates (that would be necessary to remove the properties).
  *
  * @param NodeInterface $node
  * @return void
  */
 public function cleanUpProperties(NodeInterface $node)
 {
     if ($node->isRemoved() === false) {
         $nodeData = $node->getNodeData();
         $nodeTypeProperties = $node->getNodeType()->getProperties();
         foreach ($node->getProperties() as $name => $value) {
             if (!isset($nodeTypeProperties[$name])) {
                 $nodeData->removeProperty($name);
             }
         }
     }
 }