/** * * @return array */ public function updateAction() { if ($this->getRequest()->isPost()) { $params = $this->getRequest()->getParams(); $id = $this->getRequest()->getParam('id'); $color = ColorQuery::create()->findByPKOrThrow($id, $this->i18n->_("It does not exist the Color with id {$id}")); try { $this->getColorCatalog()->beginTransaction(); ColorFactory::populate($color, $params); $this->getColorCatalog()->update($color); $this->getColorCatalog()->commit(); $code = $color->getCode(); $this->setFlash('ok', $this->i18n->_("The Color with code {$code} was updated")); } catch (Exception $e) { $this->getColorCatalog()->rollBack(); $this->setFlash('error', $this->i18n->_($e->getMessage())); } } $this->_redirect('color/list'); }
/** * * makeBean * @param array $resultset * @return \Application\Model\Bean\Color */ protected function makeBean($resultset) { return ColorFactory::createFromArray($resultset); }