Call Action In Another Action In The Same Controller

i have like this code in myController{

public function actionCreate(){

// some code

if($var > 0){

$model->actionID = $result

$model->comment = $anothervalue;

}else{

$model->actionID = $anotherresult;

$model->comment = $anothervalue;

}

in order to make the code more readable, i create in the controller a function

public function PutValue($actionvalue , $commentValue){

$model = new my();

$model->actionID = $actionvalue;

$model->comment = $commentValue;

}

and then the action create will be

public function actionCreate(){

// some code

if($var > 0){

$this->PutValue($actionvalue , $commentValue);

}else{

$this->PutValue($anotheractionvalue , $anothercommentValue);

}

the values was saved in the database as NULL, i just removed the worked code in another function

can anyone tell me the cause?

You’re not doing anything in your PutAssignAction() method. You’re creating a new model and not saving or returning it from the method.

This line of code suggests a complete misunderstanding of how setter methods should work:


$model->probation =  $model->SetProbation($category);

Hi.

Well, Keith has been faster.

greetings.