src/Bridge/Doctrine/Orm/Util/QueryBuilderHelper.php
public static function getEntityClassByAlias(string $alias, QueryBuilder $queryBuilder, ManagerRegistry $managerRegistry): string
    {
        if (!\in_array($alias, $queryBuilder->getAllAliases(), true)) {
            throw new \LogicException(sprintf('The alias "%s" does not exist in the QueryBuilder.', $alias));
        }

        $rootAliasMap = self::mapRootAliases($queryBuilder->getRootAliases(), $queryBuilder->getRootEntities());

        if (isset($rootAliasMap[$alias])) {
            return $rootAliasMap[$alias];
        }

        $metadata = null;

        foreach (self::traverseJoins($alias, $queryBuilder, $managerRegistry) as [$currentMetadata]) {
            $metadata = $currentMetadata;
        }

        if (null === $metadata) {
            throw new \LogicException(sprintf('The alias "%s" does not exist in the QueryBuilder.', $alias));
        }

        return $metadata->getName();
    }
public static function getEntityClassByAlias(string $alias, QueryBuilder $queryBuilder, ManagerRegistry $managerRegistry): string
    {
        if (!\in_array($alias, $queryBuilder->getAllAliases(), true)) {
            throw new \LogicException(sprintf('The alias "%s" does not exist in the QueryBuilder.', $alias));
        }

        $rootAliasMap = self::mapRootAliases($queryBuilder->getRootAliases(), $queryBuilder->getRootEntities());

        if (isset($rootAliasMap[$alias])) {
            return $rootAliasMap[$alias];
        }

        $metadata = null;

        foreach (self::traverseJoins($alias, $queryBuilder, $managerRegistry) as [$currentMetadata]) {
            $metadata = $currentMetadata;
        }

        if (null === $metadata) {
            throw new \LogicException(sprintf('The alias "%s" does not exist in the QueryBuilder.', $alias));
        }

        return $metadata->getName();
    }
public static function getEntityClassByAlias ( string $ alias , QueryBuilder $ queryBuilder , ManagerRegistry $ managerRegistry ) : string { if ( ! \ in_array ( $ alias , $ queryBuilder -> getAllAliases ( ) , true ) ) { throw new \ LogicException ( sprintf ( 'The alias "%s" does not exist in the QueryBuilder.' , $ alias ) ) ; } $ rootAliasMap = self :: mapRootAliases ( $ queryBuilder -> getRootAliases ( ) , $ queryBuilder -> getRootEntities ( ) ) ; if ( isset ( $ rootAliasMap [ $ alias ] ) ) { return $ rootAliasMap [ $ alias ] ; } $ metadata = null ; foreach ( self :: traverseJoins ( $ alias , $ queryBuilder , $ managerRegistry ) as [ $ currentMetadata ] ) { $ metadata = $ currentMetadata ; } if ( null === $ metadata ) { throw new \ LogicException ( sprintf ( 'The alias "%s" does not exist in the QueryBuilder.' , $ alias ) ) ; } return $ metadata -> getName ( ) ; }
Gets the entity class name by an alias used in the QueryBuilder.
Gets the entity class name by an alias used in the QueryBuilder .