Jackalope\Node::isNodeType PHP Метод

isNodeType() публичный Метод

{@inheritDoc}
public isNodeType ( $nodeTypeName )
    public function isNodeType($nodeTypeName)
    {
        $this->checkState();
        // is it the primary type?
        if ($this->primaryType === $nodeTypeName) {
            return true;
        }
        // is it one of the mixin types?
        if (isset($this->properties['jcr:mixinTypes'])) {
            if (in_array($nodeTypeName, $this->properties["jcr:mixinTypes"]->getValue())) {
                return true;
            }
        }
        $ntm = $this->session->getWorkspace()->getNodeTypeManager();
        // is the primary type a subtype of the type?
        if ($ntm->getNodeType($this->primaryType)->isNodeType($nodeTypeName)) {
            return true;
        }
        // if there are no mixin types, then we now know this node is not of that type
        if (!isset($this->properties["jcr:mixinTypes"])) {
            return false;
        }
        // is it an ancestor of any of the mixin types?
        foreach ($this->properties['jcr:mixinTypes'] as $mixin) {
            if ($ntm->getNodeType($mixin)->isNodeType($nodeTypeName)) {
                return true;
            }
        }
        return false;
    }

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);
     }
 }
All Usage Examples Of Jackalope\Node::isNodeType