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; }