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


PHP Paginator::__construct方法代码示例

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


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

示例1: __construct

 /**
  *
  * @param integer $totalRows
  * @param integer $limit
  * @param integer $offset
  * @throws Exception\InvalidUsageException
  */
 public function __construct($totalRows, $limit, $offset = 0)
 {
     $totalRows = filter_var($totalRows, FILTER_VALIDATE_INT);
     $limit = filter_var($limit, FILTER_VALIDATE_INT);
     $offset = filter_var($offset, FILTER_VALIDATE_INT);
     if (!is_int($limit) || $limit < 0) {
         throw new Exception\InvalidUsageException(__METHOD__ . ' expects limit to be an integer greater than 0');
     }
     if (!is_int($totalRows) || $totalRows < 0) {
         throw new Exception\InvalidUsageException(__METHOD__ . ' expects total rows to be an integer greater than 0');
     }
     if (!is_int($offset) || $offset < 0) {
         throw new Exception\InvalidUsageException(__METHOD__ . ' expects offset to be an integer greater than 0');
     }
     if (class_exists('\\Zend\\Paginator\\Adapter\\NullFill')) {
         // In ZF 2.4+
         $adapter = new \Zend\Paginator\Adapter\NullFill($totalRows);
     } elseif (class_exists('\\Zend\\Paginator\\Adapter\\Null')) {
         // In ZF < 2.4
         $adapter = new \Zend\Paginator\Adapter\Null($totalRows);
     } else {
         throw new Exception\RuntimeException(__METHOD__ . " Missing Zend\\Paginator\\Adapter.");
     }
     parent::__construct($adapter);
     $this->setItemCountPerPage($limit);
     $this->setCurrentPageNumber(ceil(($offset + 1) / $limit));
 }
开发者ID:robocoder,项目名称:solublecomponents,代码行数:34,代码来源:Paginator.php

示例2: DbSelect

 function __construct($select, $adapter, $result, $current_page)
 {
     $this->select = $select;
     $this->adapter = $adapter;
     $this->result = new \Zend\Db\ResultSet\ResultSet();
     $this->current_page = $current_page;
     $this->paginatorAdapter = new DbSelect($this->select, $this->adapter, $this->result);
     parent::__construct($this->paginatorAdapter);
     $this->initPaging();
 }
开发者ID:jonathan1212,项目名称:zend-tutorial,代码行数:10,代码来源:Paging.php

示例3: __construct

 public function __construct($paged_object, $page = 1, $limit = 10)
 {
     if ($paged_object instanceof \Doctrine\ORM\Query || $paged_object instanceof \Doctrine\ORM\QueryBuilder) {
         parent::__construct(new Paginator\Adapter\DoctrineQuery($paged_object));
     } elseif (is_array($paged_object)) {
         parent::__construct(new \Zend\Paginator\Adapter\ArrayAdapter($paged_object));
     } else {
         parent::__construct(new \Zend\Paginator\Adapter\NullFill($paged_object));
     }
     $this->setItemCountPerPage($limit);
     $this->setCurrentPageNumber($page);
 }
开发者ID:Lavoaster,项目名称:PVLive,代码行数:12,代码来源:Paginator.php

示例4: __construct

 public function __construct(AdapterInterface $adapter)
 {
     $this->proxy = $adapter;
     parent::__construct(new Callback([$this, 'onGetItems'], [$this, 'onCount']));
 }
开发者ID:zource,项目名称:zource,代码行数:5,代码来源:AbstractProxy.php

示例5: __construct

 public function __construct(Contact $contactTaskService)
 {
     $this->contactTaskService = $contactTaskService;
     $this->paginator = $this->contactTaskService->getOverviewPaginator('company');
     parent::__construct(new Callback([$this, 'onGetItems'], [$this, 'onCount']));
 }
开发者ID:zource,项目名称:zource,代码行数:6,代码来源:ContactCollection.php

示例6: __construct

 public function __construct($userCollection)
 {
     parent::__construct(new ArrayAdapter($userCollection));
 }
开发者ID:jerfeson,项目名称:apigility_doctrine2,代码行数:4,代码来源:UserCollection.php


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