/**
  * @param string $url
  * @param int $page
  * @param int $size
  * @return \WoohooLabs\Yin\JsonApi\Schema\Link|null
  */
 protected function createPaginatedLink($url, $page, $size)
 {
     if ($this->getTotalItems() <= 0 || $this->getLimit() <= 0) {
         return null;
     }
     return new Link($this->appendQueryStringToUrl($url, OffsetPagination::getPaginationQueryString($page, $size)));
 }
示例#2
0
文件: Request.php 项目: cwdt/yin
 /**
  * @param mixed $defaultOffset
  * @param mixed $defaultLimit
  * @return \WoohooLabs\Yin\JsonApi\Request\Pagination\OffsetPagination
  */
 public function getOffsetBasedPagination($defaultOffset = null, $defaultLimit = null)
 {
     return OffsetPagination::fromPaginationQueryParams($this->getPagination(), $defaultLimit, $defaultOffset);
 }