Hi,
I have long standing code that suddenly has broken after performing a composer update of yii and my vendor files.
In my controller I have
if ($flag = $model->save(false)) {
foreach ($modelsLegs as $modelLeg) {
$modelLeg->ProjId = $model->ProjId;
if (!($flag = $modelLeg->save(false))) {
$transaction->rollBack();
return json_encode(['status' => 'Error', 'message' => 'Leg not created!']);
break;
}
}
foreach ($modelsNotes as $modelNote) {
$modelNote->ProjId = $model->ProjId;
if (!($flag = $modelNote->save(false))) {
$transaction->rollBack();
return json_encode(['status' => 'Error', 'message' => 'Note not created!']);
break;
}
}
}
The model is saved and is the modelLeg, but the modelLeg->ProjId is not populated?
So the following lines are not working for some unknown reason after updating
$modelLeg->ProjId = $model->ProjId;
and
$modelNote->ProjId = $model->ProjId;
The controller has not changed in months.
Would anyone have any ideas? I’ve been staring at this code and not getting any ideas.
For full disclosure, this db is an Azure SQL Db and in this particular case the table uses a Trigger on Insert. But this was previously not an issue and ran fine for several months (even possibly over a year now) and only started to fail after updating.