I am implementing DAO pattern in my sample app and I have plain array that contains User(domain) fetched from UserMapper I want to use Zend_Paginator with array adapter, but it does not work it only works when I use Zend_DbTable adapter which I dont want to do because it defeats the purpose of DAO.
sample code below (Not Working)
$userMapper = new Application_Model_UserMapper();
$users = $userMapper->getUsers();
$paginator = Zend_Paginator::factory($users);
$paginator->setCurrentPageNumber($this->_getParam('page'));
$paginator->setItemCountPerPage(1);
$this->view->paginator = $paginator;
sample code below (Working)
$users = new Application_Model_DbTable_User();
$select = $users->fetchAll();
$paginator = Zend_Paginator::factory($select);
$paginator->setCurrentPageNumber($this->_getParam('page'));
$paginator->setItemCountPerPage(1);
$this->view->paginator = $paginator;
I already solve my problem, in order for array containing plain PHP objects to be recognized by the partialLoop you need to implement a toArray() method in that class and return key value pair of the attributes