Beispiel #1
0
 /**
  *
  * makeBean
  * @param array $resultset
  * @return \Application\Model\Bean\FocusGroup
  */
 protected function makeBean($resultset)
 {
     return FocusGroupFactory::createFromArray($resultset);
 }
 /**
  *
  * @return array
  */
 public function createAction()
 {
     $params = $this->getRequest()->getParams();
     try {
         // Replace the object values with the new values
         $this->getFocusGroupCatalog()->beginTransaction();
         $focusGroup = FocusGroupFactory::createFromArray($params);
         $this->getFocusGroupCatalog()->create($focusGroup);
         $npds = $params['npd'];
         foreach ($npds as $npd) {
             //die(print_r($npd));
             $this->getFocusGroupCatalog()->linkToNpdSheet($focusGroup->getIdFocusGroups(), $npd);
         }
         $respondents = $this->getRequest()->getParam("respondent");
         foreach ($respondents as $respondent) {
             if (!empty($respondent)) {
                 $this->getFocusGroupCatalog()->linkToRespondent($focusGroup->getIdFocusGroups(), $respondent);
             }
         }
         // Commit last change in database
         $this->getFocusGroupCatalog()->commit();
         $this->setFlash("ok", $this->i18n->_("FocusGroup successfully created"));
     } catch (Exception $e) {
         // Roll back any change in database
         $this->getFocusGroupCatalog()->rollBack();
         $this->setFlash("error", $this->i18n->_($e->getMessage()));
     }
     $this->setFlash("ok", "Saved");
     return $this->_redirect('focus-group/list');
 }