Admin::setModelId PHP Method

setModelId() public method

public setModelId ( integer $modelId )
$modelId integer
    public function setModelId($modelId)
    {
        $this->modelId = $modelId;
        $this->model = $this->model->findByPk($modelId);
    }

Usage Example

 /**
  * Edits or adds medications
  *
  * @param bool|int $id
  * @throws CHttpException
  */
 public function actionEdit($id = false)
 {
     $admin = new Admin(MedicationDrug::model(), $this);
     if ($id) {
         $admin->setModelId($id);
     }
     $admin->setEditFields(array('name' => 'text', 'aliases' => 'text', 'external_source' => array('widget' => 'DropDownList', 'options' => CHtml::listData(MedicationDrug::model()->findAll(new CDbCriteria(array('group' => 'external_source'))), 'external_source', 'external_source'), 'htmlOptions' => null, 'hidden' => false, 'layoutColumns' => null), 'external_code' => 'text'));
     $admin->editModel();
 }
All Usage Examples Of Admin::setModelId