R
R
rhost2014-06-16 19:39:44
Yii
rhost, 2014-06-16 19:39:44

How to update only the data that came in yii?

Data comes from the form, how to update only the data that came?
is there something like $model->updateByPk($id, $model->attributes) ? (it is not an option to prescribe each field, because if it is empty, then emptiness is filled)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2014-06-16
Protko @Fesor

solution in the forehead: before saving, get the record from the database, do a diff, do an update. This method uses Doctrine by default unless otherwise specified.
you can also make logic based on __get / __set methods to track changes in data ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question