-
Notifications
You must be signed in to change notification settings - Fork 5
/
EntryPaginatorAdapter.php
50 lines (47 loc) · 1.24 KB
/
EntryPaginatorAdapter.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
/**
* Entry Paginator Adapter
*
* @category Postr
* @package Postr_Model
*/
class Postr_Model_EntryPaginatorAdapter extends Zend_Paginator_Adapter_DbTableSelect
{
/**
* @var Postr_Model_EntryMapper
*/
private $_entryMapper;
/**
* Construct new Entry Paginator Adapter
*
* @param Zend_Db_Select $select
* @param Postr_Model_EntryMapper $entryMapper
* @return void
*/
public function __construct(
Zend_Db_Select $select,
Postr_Model_EntryMapper $entryMapper
)
{
parent::__construct($select);
$this->_entryMapper = $entryMapper;
}
/**
* Returns an array of Entry items for a page.
*
* @param integer $offset Page offset
* @param integer $itemCountPerPage Number of items per page
* @return array
*/
public function getItems($offset, $itemCountPerPage)
{
$entryRowset = parent::getItems($offset, $itemCountPerPage);
$entries = array ();
/* @var $entryRow Zend_Db_Table_Row_Abstract */
foreach ($entryRowset as $entryRow) {
$entry = $this->_entryMapper->createEntryFromRow($entryRow);
$entries[] = $entry;
}
return $entries;
}
}