protected function beforeDelete() { OphTrOperationnote_OperationDrug::model()->deleteAllByAttributes(array('ophtroperationnote_postop_drugs_id' => $this->id)); return parent::beforeDelete(); }