Answer the question
In order to leave comments, you need to log in
How to create an object of a class whose name is known in yii in the Create external action?
Good afternoon,
I figured out the external Update action , there is a static call for example:
class ShowTreeAction extends CAction{
public $pk = 'id';
public $modelClass;
function run(){
if(empty($_GET[$this->pk]))
throw new CHttpException(404);
$this->controller->render('item',array('model'=>CActiveRecord::model($this->modelClass)->findByPk((int)$_GET[$this->pk])));
}
}
function actions(){
return array(
'create'=>array(
'class'=>'application.components.actions.CreateAction',
'modelClass' => 'Product'
)
);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question