Newscoop\NewscoopBundle\Entity\Repository\TopicRepository::findAllParentChoices PHP Метод

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

Get all parent choices.
public findAllParentChoices ( Topic $node = null ) : array
$node Newscoop\NewscoopBundle\Entity\Topic Topic object
Результат array
    public function findAllParentChoices(Topic $node = null)
    {
        $dql = "SELECT c FROM {$this->_entityName} c";
        if (!is_null($node)) {
            $subSelect = "SELECT n FROM {$this->_entityName} n";
            $subSelect .= ' WHERE n.root = ' . $node->getRoot();
            $subSelect .= ' AND n.lft BETWEEN ' . $node->getLeft() . ' AND ' . $node->getRight();
            $dql .= " WHERE c.id NOT IN ({$subSelect})";
        }
        $q = $this->_em->createQuery($dql);
        $q->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, 'Gedmo\\Translatable\\Query\\TreeWalker\\TranslationWalker');
        $nodes = $q->getArrayResult();
        $indexed = array();
        foreach ($nodes as $node) {
            $indexed[$node['id']] = $node['title'];
        }
        return $indexed;
    }