Answer the question
In order to leave comments, you need to log in
How to copy, edit and save an entry?
There is a record in which you need to change the data and save it, how can this be done?
Maybe there are better solutions. What about this?
$model = new SalesOrderAddress;
$result = $model->findOne(['rule' => 'rule']);
$model2 = new SalesOrderAddress;
$model2->load($result, '');
$model2->name = 111;
$model2->save();
Answer the question
In order to leave comments, you need to log in
Use the setAttributes() and getAttributes() methods.
The logic is the same as in the code you provided.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question