private function getQueryAliasAndFields(
        $criteriaBy,
        $criteria,
        ClassMetadata $metadata,
        QueryBuilder $queryBuilder
    ) {
        $alias = null;
        $fields = null;

        if ($criteriaBy && $criteria) {
            $previousId = 97;

            if ($this->isTableRelation($metadata, $criteriaBy)) {
                $associations = explode('.', $criteriaBy);
                $fields = $associations;
                for ($i = 0; $i < count($associations) - 1; ++$i) {
                    if (false === $this->isTableRelation($metadata, $associations[$i] . '.' . $associations[$i + 1])) {
                        break;
                    }
                    $queryBuilder->innerJoin(chr($previousId) . '.' . $associations[$i], chr($previousId + 1));
                    ++$previousId;
                    foreach ($metadata->getAssociationMappings() as $associationMapping) {
                        if ($associationMapping['fieldName'] === $associations[$i]) {
                            $metadata = $this->manager->getClassMetadata($associationMapping['targetEntity']);
                        }
                    }
                    unset($fields[$i]);
                }
                $alias = chr($previousId);
                $fields = implode('.', $fields);
            } else {
                $alias = chr($previousId);
            }
        }

        return [
            $alias,
            $fields,
        ];
    }
private function getQueryAliasAndFields(
        $criteriaBy,
        $criteria,
        ClassMetadata $metadata,
        QueryBuilder $queryBuilder
    ) {
        $alias = null;
        $fields = null;

        if ($criteriaBy && $criteria) {
            $previousId = 97;

            if ($this->isTableRelation($metadata, $criteriaBy)) {
                $associations = explode('.', $criteriaBy);
                $fields = $associations;
                for ($i = 0; $i < count($associations) - 1; ++$i) {
                    if (false === $this->isTableRelation($metadata, $associations[$i] . '.' . $associations[$i + 1])) {
                        break;
                    }
                    $queryBuilder->innerJoin(chr($previousId) . '.' . $associations[$i], chr($previousId + 1));
                    ++$previousId;
                    foreach ($metadata->getAssociationMappings() as $associationMapping) {
                        if ($associationMapping['fieldName'] === $associations[$i]) {
                            $metadata = $this->manager->getClassMetadata($associationMapping['targetEntity']);
                        }
                    }
                    unset($fields[$i]);
                }
                $alias = chr($previousId);
                $fields = implode('.', $fields);
            } else {
                $alias = chr($previousId);
            }
        }

        return [
            $alias,
            $fields,
        ];
    }
private function getQueryAliasAndFields ( $ criteriaBy , $ criteria , ClassMetadata $ metadata , QueryBuilder $ queryBuilder ) { $ alias = null ; $ fields = null ; if ( $ criteriaBy && $ criteria ) { $ previousId = 97 ; if ( $ this -> isTableRelation ( $ metadata , $ criteriaBy ) ) { $ associations = explode ( '.' , $ criteriaBy ) ; $ fields = $ associations ; for ( $ i = 0 ; $ i < count ( $ associations ) - 1 ; ++ $ i ) { if ( false === $ this -> isTableRelation ( $ metadata , $ associations [ $ i ] . '.' . $ associations [ $ i + 1 ] ) ) { break ; } $ queryBuilder -> innerJoin ( chr ( $ previousId ) . '.' . $ associations [ $ i ] , chr ( $ previousId + 1 ) ) ; ++ $ previousId ; foreach ( $ metadata -> getAssociationMappings ( ) as $ associationMapping ) { if ( $ associationMapping [ 'fieldName' ] === $ associations [ $ i ] ) { $ metadata = $ this -> manager -> getClassMetadata ( $ associationMapping [ 'targetEntity' ] ) ; } } unset ( $ fields [ $ i ] ) ; } $ alias = chr ( $ previousId ) ; $ fields = implode ( '.' , $ fields ) ; } else { $ alias = chr ( $ previousId ) ; } } return [ $ alias , $ fields , ] ; }
Gets the result query alias and related fields.

@param string        $criteriaBy   The criteria key
@param string        $criteria     The criteria value
@param ClassMetadata $metadata     The Doctrine class metadata
@param QueryBuilder  $queryBuilder The query builder

@return array
Gets the result query alias and related fields .