Browse Source

Optimistic locking update (#18857)

The steps/example requires including the optimisticLock() function in the model that will return the field storing the version.
tags/2.0.44
Senthil Nathan 3 years ago committed by GitHub
parent
commit
83b4191e6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      docs/guide/db-active-record.md

6
docs/guide/db-active-record.md

@ -792,6 +792,12 @@ public function behaviors()
OptimisticLockBehavior::class, OptimisticLockBehavior::class,
]; ];
} }
public function optimisticLock()
{
return 'version';
}
``` ```
> Note: Because [[\yii\behaviors\OptimisticLockBehavior|OptimisticLockBehavior]] will ensure the record is only saved > Note: Because [[\yii\behaviors\OptimisticLockBehavior|OptimisticLockBehavior]] will ensure the record is only saved
> if user submits a valid version number by directly parsing [[\yii\web\Request::getBodyParam()|getBodyParam()]], it > if user submits a valid version number by directly parsing [[\yii\web\Request::getBodyParam()|getBodyParam()]], it

Loading…
Cancel
Save