PatientAllergyAssignment::model PHP Method

model() public static method

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

Usage Example

Beispiel #1
0
 /**
  * marks the patient as having no allergies as of now
  *
  * @throws Exception
  */
 public function setNoAllergies()
 {
     $transaction = Yii::app()->db->beginTransaction();
     try {
         foreach (PatientAllergyAssignment::model()->findAll('patient_id = ?', array($this->id)) as $paa) {
             if (!$paa->delete()) {
                 throw new Exception('Unable to delete patient allergy assignment: ' . print_r($paa->getErrors(), true));
             }
             $this->audit('patient', 'remove-allergy');
         }
         $this->no_allergies_date = date('Y-m-d H:i:s');
         if (!$this->save()) {
             throw new Exception('Unable to set no allergy date:' . print_r($this->getErrors(), true));
         }
         $this->audit('patient', 'set-noallergydate');
         $transaction->commit();
     } catch (Exception $e) {
         $transaction->rollback();
         throw $e;
     }
 }
All Usage Examples Of PatientAllergyAssignment::model