1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?php
- /**
- *
- * Cube Framework $Id$ GIx4p8S/nwTLaP/4PnVENoJJ7mb1quk6iV64rEWZ/lw=
- *
- * @link http://codecu.be/framework
- * @copyright Copyright (c) 2014 CodeCube SRL
- * @license http://codecu.be/framework/license Commercial License
- *
- * @version 1.0
- */
- /**
- * db table select pagination adapter
- * returns an object of type Cube\Db\Table\Rowset\AbstractRowset
- */
- namespace Cube\Paginator\Adapter;
- use Cube\Db\Select,
- Cube\Db\Table\AbstractTable;
- class DbTableSelect extends DbSelect
- {
- /**
- *
- * table class the row belongs to
- *
- * @var \Cube\Db\Table\AbstractTable
- */
- protected $_table = null;
- /**
- *
- * class constructor
- *
- * @param \Cube\Db\Select $select the select object
- * @param \Cube\Db\Table\AbstractTable $table
- */
- public function __construct(Select $select, AbstractTable $table)
- {
- parent::__construct($select);
- $this->_table = $table;
- }
- /**
- *
- * returns an array of items for the selected page
- *
- * @param integer $offset page offset
- * @param integer $itemCountPerPage number of items per page
- * @return \Cube\Db\Table\Rowset\AbstractRowset
- */
- public function getItems($offset, $itemCountPerPage)
- {
- $this->_select->limit($itemCountPerPage, $offset);
- return $this->_table->fetchAll($this->_select);
- }
- }
|