I
I
ivapbox2017-04-11 11:46:27
Yii
ivapbox, 2017-04-11 11:46:27

How to disable update of a single attribute in Yii2?

The situation is as follows: there is a table, it has an attribute containing the file name. In the record editing form, the contents of the file are opened by this attribute, I change the contents of the file, update it, as a result (the contents change correctly), both the contents of the file and the cell with the file name change. Those. if there was a file 1234.txt, and I need to write down "helloworld" there, then this word will be both inside the file and in the cell. It is necessary that the change in the contents of the cell (SEPARATE) is not affected. How can this be implemented?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
Zhandos M, 2017-04-11
@Zhandos

It can be done through model scripts, you create a separate script and specify the attributes there that should be accepted by the load, setAttributes methods.
Naturally, if you directly assign the value to $model->field = 'value', the value will change.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question