public function indexAction() { $mainLayout = $this->initializeAdminArea(); $entityManager = $this->getServiceLocator()->get('doctrine.entitymanager.orm_default'); $lang = $this->params()->fromRoute('lang'); $languageSelection = $this->params()->fromRoute('languageSelection'); $page = $this->params()->fromRoute('page'); $moduleCode = $this->params()->fromRoute('moduleCode'); $helper = new PostsCategoriesControllerHelper(); $wrapper = $helper->recoverWrapperRecordsPaginator(new PostsCategoriesGetterWrapper(new PostsCategoriesGetter($entityManager)), array("moduleCode" => $moduleCode, 'languageAbbreviation' => $languageSelection), $page, null); $paginator = $wrapper->getPaginator(); $records = $wrapper->setupRecords(); $columnRecords = array(); foreach ($records as $record) { $columnRecords[] = array($record['name'], $record['description'] != '' ? $record['description'] : ' ', $record['createDate'], array('type' => 'updateButton', 'href' => $this->url()->fromRoute('admin/posts-categories-form', array('lang' => $this->params()->fromRoute('lang'), 'languageSelection' => $this->params()->fromRoute('languageSelection'), 'previouspage' => $this->params()->fromRoute('page'), 'formtype' => $this->params()->fromRoute('moduleCode'), 'id' => $record['id'])), 'title' => 'Modifica categoria'), array('type' => 'deleteButton', 'href' => '#', 'data-id' => $record['id'], 'title' => 'Elimina categoria blog')); } $this->layout()->setVariables(array('tableTitle' => 'Categorie ', 'tableDescription' => $paginator->getTotalItemCount() . ' categorie in archivio', 'columns' => array("Nome", "Descrizione", "Data creazione", " ", " "), 'paginator' => $paginator, 'records' => $columnRecords, 'formBreadCrumbCategory' => array(array('label' => $helper->recoverLabelByModuleCode($moduleCode), 'href' => $this->url()->fromRoute($helper->recoverRouteByModuleCode($moduleCode), array('lang' => $lang, 'languageSelection' => $languageSelection)), 'title' => $helper->recoverLabelByModuleCode($moduleCode))), 'templatePartial' => self::summaryTemplate)); $this->layout()->setTemplate($mainLayout); }
/** * @expectedException \Exception */ public function testRecoverRouteByModuleCodeThrowsException() { $this->helper->recoverRouteByModuleCode('nopostmodulecode'); }