Pagination in zend framework

public function indexAction() { $data = $this->_em->getRepository('Application_Model_User') ->findBy(array('isDelete' => 0, 'roleId' => 2)); /* Pagination */ $page = $this->_getParam('page', 1); $paginator = Zend_Paginator::factory($data); $paginator->setItemCountPerPage(8); $paginator->setCurrentPageNumber($page); $paginator->setPageRange(1); $this->view->homeData = $paginator; }

Share This:


Fetch row in zend framework

public function getDetail($id) { $customer = array('cid', 'esid', 'name', 'broker_code'); $broker_new = array('sid', 'company_name', 'broker_name','phone_number'); $select = $this->select() ->setIntegrityCheck(false) ->from(array('c' => 'customer'),$customer); $select->join(array('b' => 'broker_new'), 'b.broker_code=c.broker_code', $broker_new); $select->where('c.cid =?',$id); $row = $this->fetchRow($select); if($row){ return $row; }else{ return false; } }

Share This:


Join in zend framework

public function getFilteredCustomers($search_text) {
$customers = array('cid', 'esid', 'name', 'broker_code');
$broker_new = array('company_name');
$select = $this->select()
->setIntegrityCheck(false)
->from(array('c' => 'customer'), $customers);
$select->join(array('b' => 'broker_new'), 'c.broker_code=b.broker_code', $broker_new);
$select->where('c.name LIKE ?', $search_text.'%');
$select->where('c.status = ?', 1);
return $this->fetchAll($select);
}

Share This: