Hi,
I’m having problems accessing parameters sent in post.
$model = new Commandes();
if ($model->load(Yii::$app->request->post()) ) {
$model_n = Commandes::find()->where(['num_de_serie' => $model->num_de_serie ])->one();
$model_n->nv_agence_id = $model->nv_agence_id;
$model_n->date_reafectation = $model->date_reafectation;
$model_n->nv_num_pwc = $model->nv_num_pwc;
if($model_n->save())
return $this->redirect(['view', 'id' => $model_n->num_de_serie]);
} else {
return $this->render('reaffectation', ['model' => $model,]);
}
I added those three attribute after generating the model with GII and expect ‘$model->num_de_serie’ (this was created originally) they’re all NULL even even though the debugger show this :
$_POST
Name Value
_csrf ‘QWlURS42Y3hzAwIWaW81HQIiZQFEdxFKNF1hAHl3UyAkAC51dE8pKQ==’
Commandes [
'num_de_serie' => 'koko'
'nv_agence_id' => 'XXQ06J'
'date_reafectation' => '2016-04-30'
'nv_num_pwc' => 'iioioo'
]
Any suggestion ?