/**
  * @param QOM\SelectorInterface $source
  *
  * @return Term
  */
 public function walkSelectorSource(QOM\SelectorInterface $source)
 {
     $this->source = $source;
     $nodeTypeName = $source->getNodeTypeName();
     if (!$this->nodeTypeManager->hasNodeType($nodeTypeName)) {
         throw new InvalidQueryException(sprintf('Node type does not exist "%s"', $nodeTypeName));
     }
     return sprintf('%s:%s', $this->escape('jcr:primaryType'), $this->escape($source->getNodeTypeName()));
 }
 /**
  * @param QOM\SelectorInterface $source
  *
  * @throws \PHPCR\Query\InvalidQueryException
  */
 protected function validateSelectorSource(QOM\SelectorInterface $source)
 {
     $nodeType = $source->getNodeTypeName();
     if (!$this->nodeTypeManager->hasNodeType($nodeType)) {
         $msg = 'Selected node type does not exist: ' . $nodeType;
         if ($alias = $source->getSelectorName()) {
             $msg .= ' AS ' . $alias;
         }
         throw new InvalidQueryException($msg);
     }
 }
 /**
  * check if node types exist without fetching them.
  */
 public function testHasNodeType()
 {
     $this->assertTrue($this->nodeTypeManager->hasNodeType('nt:file'));
     $this->assertFalse($this->nodeTypeManager->hasNodeType('no-such-type'));
 }