Exemplo n.º 1
0
 /**
  *
  * makeBean
  * @param array $resultset
  * @return \Application\Model\Bean\Family
  */
 protected function makeBean($resultset)
 {
     return FamilyFactory::createFromArray($resultset);
 }
Exemplo n.º 2
0
 public function createAction()
 {
     $family = new Family();
     $params = $this->getRequest()->getParams();
     try {
         // Replace the object values with the new values
         $this->getFamilyCatalog()->beginTransaction();
         $familyFactory = FamilyFactory::createFromArray($params);
         // Default status = active
         $familyFactory->setStatus(Family::$Status['Active']);
         // Create family
         $this->getFamilyCatalog()->create($familyFactory);
         // Commit last change in database
         $this->getFamilyCatalog()->commit();
     } catch (Exception $e) {
         // Roll back any change in database
         $this->getFamilyCatalog()->rollBack();
         $this->setFlash("error", $this->i18n->_($e->getMessage()));
     }
     $id = $familyFactory->getIdFamily();
     $this->setFlash("ok", $this->i18n->_("The Family with id {$id} was created"));
     return $this->_redirect('family/list');
 }