ApiPlatform\Core\Bridge\Doctrine\Orm\Util\QueryChecker::hasRootEntityWithCompositeIdentifier PHP Method

hasRootEntityWithCompositeIdentifier() public static method

Determines whether the query builder has any composite identifier.
public static hasRootEntityWithCompositeIdentifier ( Doctrine\ORM\QueryBuilder $queryBuilder, Doctrine\Common\Persistence\ManagerRegistry $managerRegistry ) : boolean
$queryBuilder Doctrine\ORM\QueryBuilder
$managerRegistry Doctrine\Common\Persistence\ManagerRegistry
return boolean
    public static function hasRootEntityWithCompositeIdentifier(QueryBuilder $queryBuilder, ManagerRegistry $managerRegistry) : bool
    {
        return self::hasRootEntityWithIdentifier($queryBuilder, $managerRegistry, false);
    }

Usage Example

Example #1
0
 public function testHasRootEntityWithNoCompositeIdentifier()
 {
     $queryBuilder = $this->prophesize(QueryBuilder::class);
     $queryBuilder->getRootEntities()->willReturn(['Dummy']);
     $queryBuilder->getRootAliases()->willReturn(['d']);
     $classMetadata = new ClassMetadata('Dummy');
     $classMetadata->containsForeignIdentifier = false;
     $objectManager = $this->prophesize(ObjectManager::class);
     $objectManager->getClassMetadata('Dummy')->willReturn($classMetadata);
     $managerRegistry = $this->prophesize(ManagerRegistry::class);
     $managerRegistry->getManagerForClass('Dummy')->willReturn($objectManager->reveal());
     $this->assertFalse(QueryChecker::hasRootEntityWithCompositeIdentifier($queryBuilder->reveal(), $managerRegistry->reveal()));
 }
All Usage Examples Of ApiPlatform\Core\Bridge\Doctrine\Orm\Util\QueryChecker::hasRootEntityWithCompositeIdentifier