Esempio n. 1
0
 /**
  *
  * @return array
  */
 public function updateAction()
 {
     if ($this->getRequest()->isPost()) {
         $params = $this->getRequest()->getParams();
         $id = $this->getRequest()->getParam('id_poll');
         $poll = PollQuery::create()->findByPKOrThrow($id, $this->i18n->_("The Poll with id {$id} does not exist"));
         try {
             $this->getPollCatalog()->beginTransaction();
             PollFactory::populate($poll, $params);
             $this->getPollCatalog()->update($poll);
             $this->getPollCatalog()->commit();
             $this->setFlash('ok', $this->i18n->_("The Poll with id {$id} was update."));
         } catch (Exception $e) {
             $this->getPollCatalog()->rollBack();
             $this->setFlash('error', $this->i18n->_($e->getMessage()));
         }
     }
     $this->_redirect('poll/list');
 }
Esempio n. 2
0
 /**
  *
  * makeBean
  * @param array $resultset
  * @return \Application\Model\Bean\Poll
  */
 protected function makeBean($resultset)
 {
     return PollFactory::createFromArray($resultset);
 }