private function buildQuery(
        QueryBuilder $queryBuilder,
        FullyQualifiedClassName $section,
        array $fetchFields
    ): QueryBuilder {

        // 1: Get the entities that belong to the fields we want to query
        $this->buildReflections($section, $fetchFields);
        reset($this->reflections);
        $start = $this->reflections[key($this->reflections)];

        // 2: Make select properties
        $this->makeSelectProperties($start);

        // 3: Make joins
        $this->makeJoins($start);

        // 4: And bring it all together in the query builder
        $queryBuilder->addSelect($this->selectProperties);
        $queryBuilder->from($start['reflection']->getName(), $start['propertyName']);
        array_multisort($this->joins);
        foreach ($this->joins as $join=>$order) {
            $joinOn = explode(' ', $join);
            $queryBuilder->leftJoin($joinOn[0], $joinOn[1]);
        }

        return $queryBuilder;
    }
private function buildQuery(
        QueryBuilder $queryBuilder,
        FullyQualifiedClassName $section,
        array $fetchFields
    ): QueryBuilder {

        // 1: Get the entities that belong to the fields we want to query
        $this->buildReflections($section, $fetchFields);
        reset($this->reflections);
        $start = $this->reflections[key($this->reflections)];

        // 2: Make select properties
        $this->makeSelectProperties($start);

        // 3: Make joins
        $this->makeJoins($start);

        // 4: And bring it all together in the query builder
        $queryBuilder->addSelect($this->selectProperties);
        $queryBuilder->from($start['reflection']->getName(), $start['propertyName']);
        array_multisort($this->joins);
        foreach ($this->joins as $join=>$order) {
            $joinOn = explode(' ', $join);
            $queryBuilder->leftJoin($joinOn[0], $joinOn[1]);
        }

        return $queryBuilder;
    }
private function buildQuery ( QueryBuilder $ queryBuilder , FullyQualifiedClassName $ section , array $ fetchFields ) : QueryBuilder { // 1: Get the entities that belong to the fields we want to query $ this -> buildReflections ( $ section , $ fetchFields ) ; reset ( $ this -> reflections ) ; $ start = $ this -> reflections [ key ( $ this -> reflections ) ] ; // 2: Make select properties $ this -> makeSelectProperties ( $ start ) ; // 3: Make joins $ this -> makeJoins ( $ start ) ; // 4: And bring it all together in the query builder $ queryBuilder -> addSelect ( $ this -> selectProperties ) ; $ queryBuilder -> from ( $ start [ 'reflection' ] -> getName ( ) , $ start [ 'propertyName' ] ) ; array_multisort ( $ this -> joins ) ; foreach ( $ this -> joins as $ join => $ order ) { $ joinOn = explode ( ' ' , $ join ) ; $ queryBuilder -> leftJoin ( $ joinOn [ 0 ] , $ joinOn [ 1 ] ) ; } return $ queryBuilder ; }
Run the steps required to make the query

@param QueryBuilder $queryBuilder
@param FullyQualifiedClassName $section
@param array $fetchFields
@return QueryBuilder
Run the steps required to make the query