model() public static method

Returns the static model of the specified AR class.
public static model ( $className = __CLASS__ ) : Complication
return Complication the static model class
Exemplo n.º 1
0
 /**
  * Edits or adds a Procedure.
  *
  * @param bool|int $id
  *
  * @throws CHttpException
  */
 public function actionEdit($id = false)
 {
     $admin = new Admin(Procedure::model(), $this);
     if ($id) {
         $admin->setModelId($id);
     }
     $admin->setEditFields(array('term' => 'text', 'short_format' => 'text', 'default_duration' => 'text', 'snomed_code' => 'text', 'snomed_term' => 'text', 'aliases' => 'text', 'unbooked' => 'checkbox', 'active' => 'checkbox', 'opcsCodes' => array('widget' => 'MultiSelectList', 'relation_field_id' => 'id', 'label' => 'OPCS Code', 'options' => CHtml::encodeArray(CHtml::listData(OPCSCode::model()->findAll(), 'id', function ($model) {
         return $model->name . ': ' . $model->description;
     }))), 'benefits' => array('widget' => 'MultiSelectList', 'relation_field_id' => 'id', 'label' => 'Benefit', 'options' => CHtml::encodeArray(CHtml::listData(Benefit::model()->findAll(), 'id', 'name'))), 'complications' => array('widget' => 'MultiSelectList', 'relation_field_id' => 'id', 'label' => 'Complication', 'options' => CHtml::encodeArray(CHtml::listData(Complication::model()->findAll(), 'id', 'name')))));
     if (isset($admin->getModel()->operationNotes)) {
         $admin->setEditFields(array_merge($admin->getEditFields(), array('operationNotes' => array('widget' => 'MultiSelectList', 'relation_field_id' => 'id', 'label' => 'Operation Note Element', 'options' => CHtml::encodeArray(CHtml::listData(ElementType::model()->findAllByAttributes(array(), 'event_type_id in (select id from event_type where name = "Operation Note")'), 'id', 'name'))))));
     }
     $admin->editModel();
 }
Exemplo n.º 2
0
 /**
  * @covers Complication::model
  */
 public function testModel()
 {
     $this->assertEquals('Complication', get_class(Complication::model()), 'Class name should match model.');
 }
 /**
  * Deletes rows for the model
  */
 public function actionDelete()
 {
     $admin = new Admin(Complication::model(), $this);
     $admin->deleteModel();
 }