当前位置: 首页>>代码示例>>PHP>>正文


PHP RequestConfiguration::getLimit方法代码示例

本文整理汇总了PHP中Sylius\Bundle\ResourceBundle\Controller\RequestConfiguration::getLimit方法的典型用法代码示例。如果您正苦于以下问题:PHP RequestConfiguration::getLimit方法的具体用法?PHP RequestConfiguration::getLimit怎么用?PHP RequestConfiguration::getLimit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sylius\Bundle\ResourceBundle\Controller\RequestConfiguration的用法示例。


在下文中一共展示了RequestConfiguration::getLimit方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1:

 function it_uses_custom_method_and_arguments_if_specified(RequestConfiguration $requestConfiguration, RepositoryInterface $repository, ResourceInterface $firstResource)
 {
     $requestConfiguration->isHtmlRequest()->willReturn(true);
     $requestConfiguration->getRepositoryMethod()->willReturn('findAll');
     $requestConfiguration->getRepositoryArguments()->willReturn(array('foo'));
     $requestConfiguration->isPaginated()->willReturn(false);
     $requestConfiguration->isLimited()->willReturn(true);
     $requestConfiguration->getLimit()->willReturn(15);
     $repository->findAll('foo')->willReturn(array($firstResource));
     $this->get($requestConfiguration, $repository)->shouldReturn(array($firstResource));
 }
开发者ID:Spomky,项目名称:Sylius,代码行数:11,代码来源:ResourcesCollectionProviderSpec.php

示例2: getResources

 /**
  * {@inheritdoc}
  */
 public function getResources(RequestConfiguration $requestConfiguration, RepositoryInterface $repository)
 {
     if (null !== ($repositoryMethod = $requestConfiguration->getRepositoryMethod())) {
         $callable = [$repository, $repositoryMethod];
         $resources = call_user_func_array($callable, $requestConfiguration->getRepositoryArguments());
         return $resources;
     }
     if (!$requestConfiguration->isPaginated() && !$requestConfiguration->isLimited()) {
         return $repository->findBy($requestConfiguration->getCriteria(), $requestConfiguration->getSorting());
     }
     if (!$requestConfiguration->isPaginated()) {
         return $repository->findBy($requestConfiguration->getCriteria(), $requestConfiguration->getSorting(), $requestConfiguration->getLimit());
     }
     return $repository->createPaginator($requestConfiguration->getCriteria(), $requestConfiguration->getSorting());
 }
开发者ID:enhavo,项目名称:enhavo,代码行数:18,代码来源:ResourcesResolver.php

示例3: getResources

 /**
  * {@inheritdoc}
  */
 public function getResources(RequestConfiguration $requestConfiguration, RepositoryInterface $repository)
 {
     $repositoryMethod = $requestConfiguration->getRepositoryMethod();
     if (null !== $repositoryMethod) {
         $arguments = array_values($requestConfiguration->getRepositoryArguments());
         return $repository->{$repositoryMethod}(...$arguments);
     }
     if (!$requestConfiguration->isPaginated() && !$requestConfiguration->isLimited()) {
         return $repository->findAll();
     }
     if (!$requestConfiguration->isPaginated()) {
         return $repository->findBy($requestConfiguration->getCriteria(), $requestConfiguration->getSorting(), $requestConfiguration->getLimit());
     }
     return $repository->createPaginator($requestConfiguration->getCriteria(), $requestConfiguration->getSorting());
 }
开发者ID:loic425,项目名称:Sylius,代码行数:18,代码来源:ResourcesResolver.php

示例4: get

 /**
  * {@inheritdoc}
  */
 public function get(RequestConfiguration $requestConfiguration, RepositoryInterface $repository)
 {
     if (null !== ($repositoryMethod = $requestConfiguration->getRepositoryMethod())) {
         $callable = [$repository, $repositoryMethod];
         return call_user_func_array($callable, $requestConfiguration->getRepositoryArguments());
     }
     if (!$requestConfiguration->isPaginated() && !$requestConfiguration->isLimited()) {
         return $repository->findAll();
     }
     if (!$requestConfiguration->isPaginated()) {
         return $repository->findBy($requestConfiguration->getCriteria(), $requestConfiguration->getSorting(), $requestConfiguration->getLimit());
     }
     $request = $requestConfiguration->getRequest();
     /** @var Pagerfanta $paginator */
     $paginator = $repository->createPaginator($requestConfiguration->getCriteria(), $requestConfiguration->getSorting());
     $paginator->setCurrentPage($request->query->get('page', 1));
     if (!$requestConfiguration->isHtmlRequest()) {
         $route = new Route($request->attributes->get('_route'), array_merge($request->attributes->get('_route_params'), $request->query->all()));
         return $this->pagerfantaRepresentationFactory->createRepresentation($paginator, $route);
     }
     return $paginator;
 }
开发者ID:Mangetsu,项目名称:Sylius,代码行数:25,代码来源:ResourcesCollectionProvider.php

示例5:

 function it_sets_current_page_on_paginator_from_custom_method(RequestConfiguration $requestConfiguration, RepositoryInterface $repository, Pagerfanta $paginator, Request $request, ParameterBag $queryParameters)
 {
     $requestConfiguration->isHtmlRequest()->willReturn(true);
     $requestConfiguration->getRepositoryMethod()->willReturn('findAll');
     $requestConfiguration->getRepositoryArguments()->willReturn(['foo']);
     $requestConfiguration->isPaginated()->willReturn(true);
     $requestConfiguration->getPaginationMaxPerPage()->willReturn(5);
     $requestConfiguration->isLimited()->willReturn(true);
     $requestConfiguration->getLimit()->willReturn(15);
     $repository->findAll('foo')->willReturn($paginator);
     $requestConfiguration->getRequest()->willReturn($request);
     $request->query = $queryParameters;
     $queryParameters->get('page', 1)->willReturn(8);
     $paginator->setMaxPerPage(5)->shouldBeCalled();
     $paginator->setCurrentPage(8)->shouldBeCalled();
     $this->get($requestConfiguration, $repository)->shouldReturn($paginator);
 }
开发者ID:vikey89,项目名称:Sylius,代码行数:17,代码来源:ResourcesCollectionProviderSpec.php


注:本文中的Sylius\Bundle\ResourceBundle\Controller\RequestConfiguration::getLimit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。