Jackalope\Node::getPropertiesForStoreDeletedNode PHP Method

getPropertiesForStoreDeletedNode() public method

This method is only meant for the transport to be able to still build a store request for afterwards deleted nodes to support the operationslog.
See also: Jackalope\Transport\WritingInterface::storeNodes
public getPropertiesForStoreDeletedNode ( ) : Property[]
return Property[] with just the jcr:primaryType property in it
    public function getPropertiesForStoreDeletedNode()
    {
        if (!$this->isDeleted()) {
            throw new InvalidItemStateException('You are not supposed to call this on a not deleted node');
        }
        $myProperty = $this->properties['jcr:primaryType'];
        $myProperty->setClean();
        $path = $this->getChildPath('jcr:primaryType');
        $property = $this->factory->get('Property', array(array('type' => $myProperty->getType(), 'value' => $myProperty->getValue()), $path, $this->session, $this->objectManager));
        $myProperty->setDeleted();
        return array('jcr:primaryType' => $property);
    }

Usage Example

Example #1
0
 private function phpcrNodeToNode(\Jackalope\Node $node)
 {
     if ($node->isDeleted()) {
         $properties = $node->getPropertiesForStoreDeletedNode();
     } else {
         $this->nodeProcessor->process($node);
         $properties = $node->getProperties();
     }
     $node = new Node();
     $node->fromPhpcrProperties($properties);
     return $node;
 }