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;
    }