/** * 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); }
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']; }
/** * 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; }
public function insert(array $data) { $data['apiKey'] = $this->_generateApiKey(); $data = array_merge($data); return parent::insert($data); }
public function insert(array $data) { $tagId = parent::insert($data); //$this->index($tagId, $data['name']); return $tagId; }
/** * 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; }
/** * 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; }
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; }
/** * Overrides the insert method to clear the cache after the insert takes place */ public function insert(array $data) { parent::insert($data); $this->_clearCache(); }