applyToCollection() public method

public applyToCollection ( Doctrine\ORM\QueryBuilder $queryBuilder, ApiPlatform\Core\Bridge\Doctrine\Orm\Util\QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, string $operationName = null )
$queryBuilder Doctrine\ORM\QueryBuilder
$queryNameGenerator ApiPlatform\Core\Bridge\Doctrine\Orm\Util\QueryNameGeneratorInterface
$resourceClass string
$operationName string
Ejemplo n.º 1
0
 public function testApplyToCollectionPaginationDisabled()
 {
     $requestStack = new RequestStack();
     $requestStack->push(new Request());
     $resourceMetadataFactoryProphecy = $this->prophesize(ResourceMetadataFactoryInterface::class);
     $resourceMetadataFactoryProphecy->create('Foo')->willReturn(new ResourceMetadata(null, null, null, [], []))->shouldBeCalled();
     $resourceMetadataFactory = $resourceMetadataFactoryProphecy->reveal();
     $queryBuilderProphecy = $this->prophesize(QueryBuilder::class);
     $queryBuilderProphecy->setFirstResult(Argument::any())->shouldNotBeCalled();
     $queryBuilderProphecy->setMaxResults(Argument::any())->shouldNotBeCalled();
     $queryBuilder = $queryBuilderProphecy->reveal();
     $extension = new PaginationExtension($this->prophesize(ManagerRegistry::class)->reveal(), $requestStack, $resourceMetadataFactory, false);
     $extension->applyToCollection($queryBuilder, new QueryNameGenerator(), 'Foo', 'op');
 }