Hello,
I have a problem with $model->save() method, because it doesn’t save all the parameters. For example I have text field input called label_lot_no, which is identical in terms of definition to param lot_no, but $model->save() saves only label_lot_no when lot_no remains null even tho value is loaded properly, there are no errors in validation and $model->lot_no has a value before save and after save but still - it is not saved into db. Rules in model class are identical aswell. Any ideas? Theres my code:
$model = $this->findModel($id);
$workers = $model->productionPackingWorkers;
$transaction = \Yii::$app->db->beginTransaction();
$status = true;
if ($model->load(Yii::$app->request->post()) && $model->validate()) {
$workers = Model::createMultiple(ProductionPackingWorker::classname(), $workers);
Model::loadMultiple($workers, Yii::$app->request->post());
try {
$status &= $model->save();
if ($status) {
$transaction->commit();
} else {
$transaction->rollBack();
}
} catch (Exception $e) {
$transaction->rollBack();
}
}