src/Utilities/QueryBuilderUtility.php
public static function getJoinedPropertyAlias(QueryBuilder $queryBuilder, $property)
    {
        $joins = $queryBuilder->getDQLPart('join');

        /*
         * No joins?
         * Nothing to do
         */
        if (empty($joins)) {
            return null;
        }

        $patternTemplate = '/^.+\.%s$/'; // e.g. "SomeThing.PropertyName"
        $pattern = sprintf($patternTemplate, $property);

        foreach ($joins as $joinExpressions) {
            /** @var Join $expression */
            foreach ($joinExpressions as $expression) {
                $joinedProperty = $expression->getJoin();

                if (preg_match($pattern, $joinedProperty)) {
                    return $expression->getAlias();
                }
            }
        }

        return null;
    }
public static function getJoinedPropertyAlias(QueryBuilder $queryBuilder, $property)
    {
        $joins = $queryBuilder->getDQLPart('join');

        /*
         * No joins?
         * Nothing to do
         */
        if (empty($joins)) {
            return null;
        }

        $patternTemplate = '/^.+\.%s$/'; // e.g. "SomeThing.PropertyName"
        $pattern = sprintf($patternTemplate, $property);

        foreach ($joins as $joinExpressions) {
            /** @var Join $expression */
            foreach ($joinExpressions as $expression) {
                $joinedProperty = $expression->getJoin();

                if (preg_match($pattern, $joinedProperty)) {
                    return $expression->getAlias();
                }
            }
        }

        return null;
    }
public static function getJoinedPropertyAlias ( QueryBuilder $ queryBuilder , $ property ) { $ joins = $ queryBuilder -> getDQLPart ( 'join' ) ; /*
         * No joins?
         * Nothing to do
         */ if ( empty ( $ joins ) ) { return null ; } $ patternTemplate = '/^.+\.%s$/' ; // e.g. "SomeThing.PropertyName" $ pattern = sprintf ( $ patternTemplate , $ property ) ; foreach ( $ joins as $ joinExpressions ) { /** @var Join $expression */ foreach ( $ joinExpressions as $ expression ) { $ joinedProperty = $ expression -> getJoin ( ) ; if ( preg_match ( $ pattern , $ joinedProperty ) ) { return $ expression -> getAlias ( ) ; } } } return null ; }
Returns alias of given property joined in given query builder

If there are no joins or the join does not exist, null is returned.
It's also information if given property is already joined in given query builder.

@param QueryBuilder $queryBuilder The query builder to verify
@param string       $property     Name of property that maybe is joined
@return null|string
Returns alias of given property joined in given query builder