public function poolsAction() { if (!$this->getRequest()->isGet()) { throw new AppEx\UnexpectedException("Resquest must be GET"); } $id = $this->_getParam('id', null); if (!isset($id) && !strlen($id)) { throw new AppEx\InvalidArgumentException('You must indicate a commercial group id'); } $commercialGroup = $this->_cgSrv->load($id); if (empty($commercialGroup)) { throw new NotFoundException("Commercial Group {$id} not found", 404); } // Check permissions $this->_helper->allowed('read', $commercialGroup); $pools = $this->_cgSrv->getPools($id); //check permissions for pools if ($pools) { $this->_helper->filterNotAllowedFields('read_field', $pools); } // Response with the list of pools $this->view->data = $pools; }