/** * @return void */ public function indexAction() { // Mapping $mapping = array('id' => 'story.id', 'active' => 'story.active', 'description' => 'storyTranslation.description', 'title' => 'title'); //KBBTODO move dql to models $ids = $this->_helper->search('Model_Entity_Story', true); $query = Kebab_Model_Story::getStory($ids)->orderBy($this->_helper->sort($mapping)); $pager = $this->_helper->pagination($query); $story = $pager->execute(); // Response $responseData = is_object($story) ? $story->toArray() : array(); $this->_helper->response(true)->addData($responseData)->addTotal($pager->getNumResults())->getResponse(); }
public function indexAction() { $params = $this->_helper->param(); $roleId = $params['roleId']; // Mapping for order $mapping = array('id' => 'story.id', 'title' => 'storyTranslation.title', 'description' => 'storyTranslation.description', 'allow' => 'allow'); $order = $this->_helper->sort($mapping); $ids = $this->_helper->search('Model_Entity_Story', true); $query = Kebab_Model_Story::getStory($ids, $roleId)->orderBy($order); $pager = $this->_helper->pagination($query); $story = $pager->execute(); $responseData = is_object($story) ? $story->toArray() : array(); $this->_helper->response(true)->addData($responseData)->addTotal(count($responseData))->getResponse(); }