예제 #1
0
 /**
  * 
  * @return int|bool
  */
 public function save()
 {
     $dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter();
     $dbAdapter->beginTransaction();
     try {
         $this->setValidators(array('_checkScholarityName', '_checkScholarityExternalCode'));
         if (!parent::isValid()) {
             return false;
         }
         if (empty($this->_data['id_perscholarity'])) {
             $history = 'INSERE KURSU: %s DADUS PRINCIPAL - INSERE NOVO KURSU';
         } else {
             $history = 'ALTERA KURSU: %s DADUS PRINCIPAL - ALTERA KURSU';
         }
         $id = parent::_simpleSave();
         $history = sprintf($history, $this->_data['scholarity']);
         $this->_sysAudit($history);
         $dbAdapter->commit();
         return $id;
     } catch (Exception $e) {
         $dbAdapter->rollBack();
         $this->_message->addMessage($this->_config->messages->error, App_Message::ERROR);
         return false;
     }
 }