Example #1
0
 /**
  * Queues an email in the system
  *
  * @param array $data
  * @return results from insert
  */
 public function queueEmail($data)
 {
     $data['queueDt'] = time();
     $data['zendMailObject'] = serialize($data['zendMailObject']);
     $data['status'] = 'waiting';
     $data['sentDt'] = 0;
     return parent::insert($data);
 }
Example #2
0
 public function generateCodeForUser($userId)
 {
     $data = array('userId' => $userId, 'code' => md5(microtime()));
     $thisCode = $this->find($userId);
     if (is_null($thisCode)) {
         parent::insert($data);
     } else {
         parent::update($data, null);
     }
     return $data['code'];
 }
Example #3
0
 /**
  * Inserts a new row into the table
  *
  * @param array $data
  * @return Result from Zend_Db_Table::insert()
  */
 public function insert(array $data)
 {
     $dba = $this->getAdapter();
     $dba->beginTransaction();
     $bt = new Ot_Model_DbTable_BugText();
     $text = $data['text'];
     unset($data['text']);
     try {
         $bugId = parent::insert($data);
     } catch (Exception $e) {
         $dba->rollback();
         throw $e;
     }
     try {
         $text['bugId'] = $bugId;
         $bt->insert($text);
     } catch (Exception $e) {
         $dba->rollback();
         throw $e;
     }
     $dba->commit();
     return $bugId;
 }
Example #4
0
 public function insert(array $data)
 {
     $data['apiKey'] = $this->_generateApiKey();
     $data = array_merge($data);
     return parent::insert($data);
 }
Example #5
0
 public function insert(array $data)
 {
     $tagId = parent::insert($data);
     //$this->index($tagId, $data['name']);
     return $tagId;
 }
Example #6
0
 /**
  * Inserts a new role into the database
  *
  * @param array $data
  * @return int roleId
  */
 public function insert(array $data)
 {
     $roleId = parent::insert($data);
     $this->_clearCache();
     return $roleId;
 }
Example #7
0
 /**
  * inserts a new user and also takes care of account_roles if $data['role'] is set
  */
 public function insert(array $data)
 {
     $inTransaction = false;
     //whether or not we're in a transaction prior to this
     $dba = $this->getAdapter();
     try {
         $dba->beginTransaction();
     } catch (Exception $e) {
         $inTransaction = true;
     }
     $roleIds = array();
     if (isset($data['role']) && count($data['role']) > 0) {
         $roleIds = (array) $data['role'];
         unset($data['role']);
     }
     try {
         $accountId = parent::insert($data);
     } catch (Exception $e) {
         if (!$inTransaction) {
             $dba->rollback();
         }
         throw new Ot_Exception('Account insert failed.');
     }
     if (count($roleIds) > 0) {
         $accountRoles = new Ot_Model_DbTable_AccountRoles();
         foreach ($roleIds as $r) {
             $accountRoles->insert(array('accountId' => $accountId, 'roleId' => $r));
         }
     }
     if (!$inTransaction) {
         $dba->commit();
     }
     return $accountId;
 }
Example #8
0
 public function insert(array $data)
 {
     $keys = array();
     if ($data['evaluationType'] == 'google') {
         $keys['formKey'] = $data['formKey'];
         $keys['answerKey'] = $data['answerKey'];
     }
     unset($data['formKey'], $data['answerKey']);
     $dba = $this->getAdapter();
     $inTransaction = false;
     try {
         $dba->beginTransaction();
     } catch (Exception $e) {
         $inTransaction = true;
     }
     try {
         $eventId = parent::insert($data);
     } catch (Exception $e) {
         if ($inTransaction) {
             $dba->rollBack();
         }
         throw $e;
     }
     if (count($keys) > 0) {
         $keys['eventId'] = $eventId;
         $evaluationKey = new Evaluation_Key();
         try {
             $evaluationKey->insert($keys);
         } catch (Exception $e) {
             if (!$inTransaction) {
                 $dba->rollBack();
             }
             throw $e;
         }
     }
     if (!$inTransaction) {
         $dba->commit();
     }
     return $eventId;
 }
Example #9
0
 /**
  * Overrides the insert method to clear the cache after the insert takes place
  */
 public function insert(array $data)
 {
     parent::insert($data);
     $this->_clearCache();
 }