Download the PHP package yii-dream-team/yii2-lockable-activerecord without Composer
On this page you can find all versions of the php package yii-dream-team/yii2-lockable-activerecord. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download yii-dream-team/yii2-lockable-activerecord
More information about yii-dream-team/yii2-lockable-activerecord
Files in yii-dream-team/yii2-lockable-activerecord
Download yii-dream-team/yii2-lockable-activerecord
More information about yii-dream-team/yii2-lockable-activerecord
Files in yii-dream-team/yii2-lockable-activerecord
Vendor yii-dream-team
Package yii2-lockable-activerecord
Short Description Pessimistic locking behavior for Yii2 ActiveRecord
License MIT
Package yii2-lockable-activerecord
Short Description Pessimistic locking behavior for Yii2 ActiveRecord
License MIT
Please rate this library. Is it a good library?
Informations about the package yii2-lockable-activerecord
Pessimistic locking behavior for Yii2 ActiveRecord
This package allows you to use pessimistic locking (select for update) when you work with ActiveRecord models.
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist yii-dream-team/yii2-lockable-activerecord "*"
or add
"yii-dream-team/yii2-lockable-activerecord": "*"
to the require
section of your composer.json.
Usage
Attach the behavior to your controller class.
public function behaviors()
{
return [
'\yiidreamteam\behaviors\LockableActiveRecord',
];
}
Add @mixin phpdoc to you class definition.
/**
* Class Sample
* @package common\models
*
* @mixin \yiidreamteam\behaviors\LockableActiveRecord
*/
class Sample extends ActiveRecord { ... }
Use model locks in transaction.
$dbTransaction = $model->getDb()->beginTransaction(\yii\db\Transaction::SERIALIZABLE);
try {
$model->lock();
$model->doSomethingWhileLocked();
$dbTransaction->commit();
} catch(\Exception $e) {
$dbTransaction->rollBack();
throw $e;
}
Licence
MIT
Links
All versions of yii2-lockable-activerecord with dependencies
PHP Build Version
Package Version
The package yii-dream-team/yii2-lockable-activerecord contains the following files
Loading the files please wait ....