/** * Delete commissioning body assignments for referential integrity * Note if patients are assigned to the practice, there will still be * a referential integrity error and the delete will fail. * * @return bool */ protected function beforeDelete() { if (parent::beforeDelete()) { foreach ($this->commissioningbodyassigments as $cba) { $cba->delete(); } return true; } }
/** * ensure we keep track of path to file before deleting from database * * @return bool * (non-PHPdoc) * @see BaseActiveRecord::beforeDelete() */ public function beforeDelete() { $this->_stored_path = $this->getPath(); return parent::beforeDelete(); }
/** * Dissociate the session from cancelled bookings and ERODs before deletion. */ protected function beforeDelete() { OphTrOperationbooking_Operation_Booking::model()->updateAll(array('session_id' => null), 'session_id = :session_id and booking_cancellation_date is not null', array(':session_id' => $this->id)); OphTrOperationbooking_Operation_EROD::model()->updateAll(array('session_id' => null), 'session_id = :session_id', array(':session_id' => $this->id)); return parent::beforeDelete(); }