FamilyHistorySide::model PHP Method

model() public static method

Returns the static model of the specified AR class.
public static model ( $className = __CLASS__ ) : FamilyHistorySide
return FamilyHistorySide the static model class
    public static function model($className = __CLASS__)
    {
        return parent::model($className);
    }

Usage Example

 public function actionAddFamilyHistory()
 {
     if (!($patient = Patient::model()->findByPk(@$_POST['patient_id']))) {
         throw new Exception("Patient not found:" . @$_POST['patient_id']);
     }
     if (!($relative = FamilyHistoryRelative::model()->findByPk(@$_POST['relative_id']))) {
         throw new Exception("Unknown relative: " . @$_POST['relative_id']);
     }
     if (!($side = FamilyHistorySide::model()->findByPk(@$_POST['side_id']))) {
         throw new Exception("Unknown side: " . @$_POST['side_id']);
     }
     if (!($condition = FamilyHistoryCondition::model()->findByPk(@$_POST['condition_id']))) {
         throw new Exception("Unknown condition: " . @$_POST['condition_id']);
     }
     if (@$_POST['edit_family_history_id']) {
         if (!($fh = FamilyHistory::model()->findByPk(@$_POST['edit_family_history_id']))) {
             throw new Exception("Family history not found: " . @$_POST['edit_family_history_id']);
         }
         $fh->relative_id = $relative->id;
         $fh->side_id = $side->id;
         $fh->condition_id = $condition->id;
         $fh->comments = @$_POST['comments'];
         if (!$fh->save()) {
             throw new Exception("Unable to save family history: " . print_r($fh->getErrors(), true));
         }
     } else {
         $patient->addFamilyHistory($relative->id, $side->id, $condition->id, @$_POST['comments']);
     }
     $this->redirect(array('patient/view/' . $patient->id));
 }
All Usage Examples Of FamilyHistorySide::model