public function updateAction() { // Get id of brand will be edit $id = $this->getRequest()->getParam("id_brand"); // Get the actual brand object $brand = BrandQuery::create()->findByPKOrThrow($id, $this->i18n->_("It does not exist the Brand with id {$id}")); try { // Replace the object values with new values $this->getBrandCatalog()->beginTransaction(); BrandFactory::populate($brand, $this->getRequest()->getParams()); // Update brand $this->getBrandCatalog()->update($brand); // Commit last change in database $this->getBrandCatalog()->commit(); $this->setFlash("ok", $this->i18n->_("The Brand was updated")); } catch (Exception $e) { // Roll back any change in database $this->getBrandCatalog()->rollBack(); $this->setFlash("error", $this->i18n->_($e->getMessage())); } return $this->_redirect('brand/list'); }
/** * * makeBean * @param array $resultset * @return \Application\Model\Bean\Brand */ protected function makeBean($resultset) { return BrandFactory::createFromArray($resultset); }