ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\AbstractFilter::addJoinsForNestedProperty PHP Method

addJoinsForNestedProperty() protected method

Adds the necessary joins for a nested property.
protected addJoinsForNestedProperty ( string $property, string $rootAlias, Doctrine\ORM\QueryBuilder $queryBuilder, ApiPlatform\Core\Bridge\Doctrine\Orm\Util\QueryNameGeneratorInterface $queryNameGenerator ) : array
$property string
$rootAlias string
$queryBuilder Doctrine\ORM\QueryBuilder
$queryNameGenerator ApiPlatform\Core\Bridge\Doctrine\Orm\Util\QueryNameGeneratorInterface
return array An array where the first element is the join $alias of the leaf entity, the second element is the $field name the third element is the $associations array
    protected function addJoinsForNestedProperty(string $property, string $rootAlias, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator) : array
    {
        $propertyParts = $this->splitPropertyParts($property);
        $parentAlias = $rootAlias;
        foreach ($propertyParts['associations'] as $association) {
            $alias = $this->addJoinOnce($queryBuilder, $queryNameGenerator, $parentAlias, $association);
            $parentAlias = $alias;
        }
        if (!isset($alias)) {
            throw new InvalidArgumentException(sprintf('Cannot add joins for property "%s" - property is not nested.', $property));
        }
        return [$alias, $propertyParts['field'], $propertyParts['associations']];
    }