public function getBranchesOfType($type, $lang = null)
 {
     $class = $this->contentTypeService->getContentTypeClass($type);
     if (null === $class) {
         throw new \InvalidArgumentException("Can’t find page class name for {$type}");
     }
     return $this->nodeVersions->getBranchesOfType($class, $lang);
 }
 private function getRefNames($ofType)
 {
     if (null === $ofType) {
         return null;
     }
     return array_filter(array_map(function ($name) {
         $contentTypeClass = $this->contentType->getContentTypeClass($name);
         if (!$contentTypeClass) {
             throw new \RuntimeException(sprintf('Class of type "%s" not found', $name));
         }
         return $contentTypeClass;
     }, (array) $ofType));
 }
 /**
  * @param ParamConverter $configuration
  *
  * @return bool
  */
 public function supports(ParamConverter $configuration)
 {
     if ("kunstmaan_extra.page" !== $configuration->getConverter()) {
         return false;
     }
     $options = $this->getOptions($configuration);
     if ($options['type_field']) {
         // we will guess the class name later in the `apply` method
         // for now assume it is supported
         return true;
     }
     $configuration->setClass($this->contentType->getContentTypeClass($configuration->getName()));
     return parent::supports($configuration);
 }
 public function configureOptions(OptionsResolver $resolver)
 {
     parent::configureOptions($resolver);
     $resolver->setDefaults(['advanced_select' => true, 'root_node' => function (Options $options) {
         return $this->domainConfiguration->getRootNode();
     }, 'lang' => function (Options $options) {
         return $this->currentLocale->getCurrentLocale();
     }, 'class' => function (Options $options) {
         return $this->contentTypeService->getContentTypeClass($options['page_name']);
     }, 'query_builder' => function (Options $options) {
         /** @var QueryBuilder $qb */
         $qb = $options['em']->getRepository($options['class'])->createQueryBuilder('e');
         $node = $options['root_node'];
         if ($node instanceof Node) {
             $qb->setParameters(['left' => $node->getLeft(), 'right' => $node->getRight()]);
         }
         $qb->setParameter('lang', $options['lang']);
         return $qb;
     }, 'empty_value' => ' ', 'required' => false]);
     $resolver->setAllowedTypes('root_node', ['null', Node::class]);
     $resolver->setRequired('page_name');
 }