Jackalope\Node::getIdentifier PHP Method

getIdentifier() public method

{@inheritDoc}
public getIdentifier ( )
    public function getIdentifier()
    {
        $this->checkState();
        if ($this->isNodeType('mix:referenceable')) {
            if (empty($this->properties['jcr:uuid'])) {
                $this->setProperty('jcr:uuid', $this->generateUuid());
            }
            return $this->getPropertyValue('jcr:uuid');
        }
        return $this->getPath();
    }

Usage Example

 /**
  * @param Node $node
  */
 private function clearNodeCache(Node $node)
 {
     $cacheKey = "nodes: {$node->getPath()}, " . $this->workspaceName;
     $this->caches['node']->delete($cacheKey);
     // actually in the DBAL all nodes have a uuid ..
     if ($node->isNodeType('mix:referenceable')) {
         $uuid = $node->getIdentifier();
         $cacheKey = "nodes by uuid: {$uuid}, " . $this->workspaceName;
         $this->caches['node']->delete($cacheKey);
     }
 }