/**
  * @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
  * @param string                $alias
  *
  * @return string
  */
 private function sqlNodeTypeClause($alias, QOM\SelectorInterface $source)
 {
     $sql = "{$alias}.type IN ('" . $source->getNodeTypeName() . "'";
     $subTypes = $this->nodeTypeManager->getSubtypes($source->getNodeTypeName());
     foreach ($subTypes as $subType) {
         /* @var $subType \PHPCR\NodeType\NodeTypeInterface */
         $sql .= ", '" . $subType->getName() . "'";
     }
     $sql .= ')';
     return $sql;
 }
 /**
  * Selector ::= nodeTypeName ['AS' selectorName]
  * nodeTypeName ::= Name
  *
  * @param  QOM\SelectorInterface $selector
  * @return string
  */
 protected function convertSelector(QOM\SelectorInterface $selector)
 {
     return $this->generator->evalSelector($selector->getNodeTypeName(), $selector->getSelectorName());
 }