Answer the question
In order to leave comments, you need to log in
How to display at least something from actionDelete in Yii?
Good afternoon, how to display information in the alert window in Yii ? So far, this only comes out if I intentionally make a syntax error in the model name.
I want to store information in a model with a NestedSet behavior attached to it . Here is a piece of external action code:
public $pk = 'id';
public $redirectTo = 'index';
public $modelClass;
function run(){
if(empty($_GET[$this->pk]))
throw new CHttpException(404);
if($_GET[$this->pk] != 1){
$model = CActiveRecord::model($this->modelClass)->findByPk((int)$_GET[$this->pk]);
$model->NAME = 'Таракан';
$model->EXIST = 0;
$model->saveNode();
}
else
throw new Exception('Нельзя удалить корневой узел');
}
Answer the question
In order to leave comments, you need to log in
not enough information. rethink how the piece of code works. mentally walk
Solved
$modelClass::model()->findByPk((int)$_GET[$this->pk])->deleteNode();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question