OphTrOperationbooking_Operation_Cancellation_Reason::model PHP Method

model() public static method

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

Usage Example

コード例 #1
0
 protected function deceasedPatients()
 {
     echo 'Cancelling operations for deceased patients: ';
     // TODO: This needs to be made more robust
     $cancellation_reason = OphTrOperationbooking_Operation_Cancellation_Reason::model()->find("text = 'Patient has died'");
     if (!$cancellation_reason) {
         throw new CException('Cannot find cancellation code for "patient has died"');
     }
     $criteria = new CDbCriteria();
     $criteria->addInCondition('`t`.status_id', array(1, 2, 3, 4));
     $criteria->addCondition('is_deceased = 1 and session_date > :dateNow');
     $criteria->params[':dateNow'] = date('Y-m-d');
     foreach (Element_OphTrOperationbooking_Operation::model()->with(array('event' => array('with' => array('episode' => array('with' => 'patient'))), 'booking'))->findAll($criteria) as $operation) {
         $operation = Element_OphTrOperationbooking_Operation::model()->findByPk($operation['id']);
         $operation->cancel($cancellation_reason->id, 'Booking cancelled automatically', 1);
         echo '.';
     }
     echo "\n";
 }
All Usage Examples Of OphTrOperationbooking_Operation_Cancellation_Reason::model