bridge/doctrine-phpcr-odm/lib/ExpressionVisitor.php
private function walkComposite(Composite $expression, AbstractNode $parentNode)
    {
        $node = $expression->getType() === Composite::AND ? $parentNode->andX() : $parentNode->orX();

        $expressions = $expression->getExpressions();

        if (empty($expressions)) {
            return $node;
        }

        $leftExpression = array_shift($expressions);
        $this->dispatch($leftExpression, $node);

        $parentNode = $node;
        foreach ($expressions as $index => $expression) {
            if (count($expressions) === $index + 1) {
                $this->dispatch($expression, $parentNode);
                break;
            }

            $this->dispatch($expression, $parentNode);
        }

        return $node;
    }
private function walkComposite(Composite $expression, AbstractNode $parentNode)
    {
        $node = $expression->getType() === Composite::AND ? $parentNode->andX() : $parentNode->orX();

        $expressions = $expression->getExpressions();

        if (empty($expressions)) {
            return $node;
        }

        $leftExpression = array_shift($expressions);
        $this->dispatch($leftExpression, $node);

        $parentNode = $node;
        foreach ($expressions as $index => $expression) {
            if (count($expressions) === $index + 1) {
                $this->dispatch($expression, $parentNode);
                break;
            }

            $this->dispatch($expression, $parentNode);
        }

        return $node;
    }
{@inheritdoc}