Commit d6f0419a by Nobuo Kihara

docs/guide/db-active-record.md - small fixes [ci skip]

parent e4860610
...@@ -1020,9 +1020,9 @@ To use Optimistic locking: ...@@ -1020,9 +1020,9 @@ To use Optimistic locking:
1. Create a column to store the version number of each row. The column type should be `BIGINT DEFAULT 0`. 1. Create a column to store the version number of each row. The column type should be `BIGINT DEFAULT 0`.
Override the `optimisticLock()` method to return the name of this column. Override the `optimisticLock()` method to return the name of this column.
2. In the Web form that collects the user input, add a hidden field that stores 2. In the Web form that collects the user input, add a hidden field that stores
the lock version of the recording being updated. the lock version of the record being updated.
3. In the controller action that does the data updating, try to catch the [[\yii\db\StaleObjectException]] 3. In the controller action that does the data updating, try to catch the [[\yii\db\StaleObjectException]]
and implement necessary business logic (e.g. merging the changes, prompting stated data) and implement necessary business logic (e.g. merging the changes, prompting staled data)
to resolve the conflict. to resolve the conflict.
Dirty Attributes Dirty Attributes
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment