public function delete($where) { $inTransaction = false; //whether or not we're in a transaction prior to this $dba = $this->getAdapter(); try { $dba->beginTransaction(); } catch (Exception $e) { $inTransaction = true; } $thisAccount = $this->fetchRow($where); $accountRoles = new Ot_Model_DbTable_AccountRoles(); $apiApps = new Ot_Model_DbTable_ApiApp(); $aar = new Ot_Account_Attribute_Register(); $cahr = new Ot_CustomAttribute_HostRegister(); $thisHost = $cahr->getHost('Ot_Profile'); try { $deleteResult = parent::delete($where); $accountRoles->delete($where); $apiApps->delete($where); $aar->delete($thisAccount->accountId); $thisHost->delete($thisAccount->accountId); } catch (Exception $e) { if (!$inTransaction) { $dba->rollback(); } throw new Ot_Exception('Account delete failed.'); } if (!$inTransaction) { $dba->commit(); } return $deleteResult; }
/** * deletes a role from the db * * @param unknown_type $where */ public function delete($where) { parent::delete($where); $this->_clearCache(); }
/** * Deletes a bug * * @param array $bugId * @return Result from Zend_Db_Table::insert() */ public function delete($bugId) { $dba = $this->getAdapter(); $dba->beginTransaction(); $bt = new Ot_Model_DbTable_BugText(); $where = $dba->quoteInto('bugId = ?', $bugId); try { parent::delete($where); } catch (Exception $e) { $dba->rollback(); throw $e; } try { $bt->delete($where); } catch (Exception $e) { $dba->rollback(); throw $e; } $dba->commit(); return true; }