getPaginationMaxPerPage() публичный Метод

public getPaginationMaxPerPage ( ) : integer
Результат integer
Пример #1
0
 function it_creates_paginator_by_default(RequestConfiguration $requestConfiguration, RepositoryInterface $repository, Pagerfanta $paginator)
 {
     $requestConfiguration->isHtmlRequest()->willReturn(true);
     $requestConfiguration->getRepositoryMethod()->willReturn(null);
     $requestConfiguration->isPaginated()->willReturn(true);
     $requestConfiguration->getPaginationMaxPerPage()->willReturn(5);
     $requestConfiguration->isLimited()->willReturn(false);
     $requestConfiguration->getCriteria()->willReturn([]);
     $requestConfiguration->getSorting()->willReturn([]);
     $repository->createPaginator([], [])->willReturn($paginator);
     $this->getResources($requestConfiguration, $repository)->shouldReturn($paginator);
 }
 function it_creates_a_paginated_representation_for_pagerfanta_for_non_html_requests(ResourcesResolverInterface $resourcesResolver, RequestConfiguration $requestConfiguration, RepositoryInterface $repository, Pagerfanta $paginator, Request $request, ParameterBag $queryParameters, ParameterBag $requestAttributes, PagerfantaFactory $pagerfantaRepresentationFactory, PaginatedRepresentation $paginatedRepresentation)
 {
     $requestConfiguration->isHtmlRequest()->willReturn(false);
     $requestConfiguration->getPaginationMaxPerPage()->willReturn(8);
     $resourcesResolver->getResources($requestConfiguration, $repository)->willReturn($paginator);
     $requestConfiguration->getRequest()->willReturn($request);
     $request->query = $queryParameters;
     $queryParameters->get('page', 1)->willReturn(6);
     $queryParameters->all()->willReturn(['foo' => 2, 'bar' => 15]);
     $request->attributes = $requestAttributes;
     $requestAttributes->get('_route')->willReturn('sylius_product_index');
     $requestAttributes->get('_route_params')->willReturn(['slug' => 'foo-bar']);
     $paginator->setMaxPerPage(8)->shouldBeCalled();
     $paginator->setCurrentPage(6)->shouldBeCalled();
     $pagerfantaRepresentationFactory->createRepresentation($paginator, Argument::type(Route::class))->willReturn($paginatedRepresentation);
     $this->get($requestConfiguration, $repository)->shouldReturn($paginatedRepresentation);
 }
 function it_creates_a_paginated_representation_for_pagerfanta_for_non_html_requests_with_a_custom_repository_method(RequestConfiguration $requestConfiguration, RepositoryInterface $repository, Pagerfanta $paginator, Request $request, ParameterBag $queryParameters, ParameterBag $requestAttributes, PagerfantaFactory $pagerfantaRepresentationFactory, PaginatedRepresentation $paginatedRepresentation)
 {
     $requestConfiguration->isHtmlRequest()->willReturn(false);
     $requestConfiguration->getRepositoryMethod()->willReturn('findAll');
     $requestConfiguration->getRepositoryArguments()->willReturn(['foo']);
     $requestConfiguration->isPaginated()->willReturn(true);
     $requestConfiguration->getPaginationMaxPerPage()->willReturn(5);
     $requestConfiguration->isLimited()->willReturn(false);
     $requestConfiguration->getCriteria()->willReturn([]);
     $requestConfiguration->getSorting()->willReturn([]);
     $repository->findAll('foo')->willReturn($paginator);
     $requestConfiguration->getRequest()->willReturn($request);
     $request->query = $queryParameters;
     $queryParameters->get('page', 1)->willReturn(6);
     $queryParameters->all()->willReturn(['foo' => 2, 'bar' => 15]);
     $request->attributes = $requestAttributes;
     $requestAttributes->get('_route')->willReturn('sylius_product_index');
     $requestAttributes->get('_route_params')->willReturn(['slug' => 'foo-bar']);
     $paginator->setMaxPerPage(5)->shouldBeCalled();
     $paginator->setCurrentPage(6)->shouldBeCalled();
     $pagerfantaRepresentationFactory->createRepresentation($paginator, Argument::type(Route::class))->willReturn($paginatedRepresentation);
     $this->get($requestConfiguration, $repository)->shouldReturn($paginatedRepresentation);
 }
Пример #4
0
 /**
  * @param RequestConfiguration $configuration
  * @param ArchetypeInterface $archetype
  * @param Pagerfanta $results
  * @param string $template
  * @param int $page
  *
  * @return Response
  */
 private function renderArchetypeResults(RequestConfiguration $configuration, ArchetypeInterface $archetype, Pagerfanta $results, $template, $page)
 {
     $results->setCurrentPage($page, true, true);
     $results->setMaxPerPage($configuration->getPaginationMaxPerPage());
     $view = View::create()->setTemplate($configuration->getTemplate($template))->setData(['archetype' => $archetype, 'products' => $results]);
     return $this->viewHandler->handle($configuration, $view);
 }
Пример #5
0
 private function renderResults(RequestConfiguration $configuration, TaxonInterface $taxon, Pagerfanta $results, $template, $page, $facets = null, $facetTags = null, $filters = null, $searchTerm = null, $searchParam = null, $requestMethod = null)
 {
     $results->setCurrentPage($page, true, true);
     $results->setMaxPerPage($configuration->getPaginationMaxPerPage());
     $view = View::create()->setTemplate($configuration->getTemplate($template))->setData(array('taxon' => $taxon, 'products' => $results, 'facets' => $facets, 'facetTags' => $facetTags, 'filters' => $filters, 'searchTerm' => $searchTerm, 'searchParam' => $searchParam, 'requestMethod' => $requestMethod));
     return $this->viewHandler->handle($configuration, $view);
 }