mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 06:15:19 +08:00
Fixed example of transactional operations in AR guide
This commit is contained in:
@ -969,12 +969,16 @@ as described in "transactions" section of "[Database basics](db-dao.md)". Anothe
|
||||
```php
|
||||
class Post extends \yii\db\ActiveRecord
|
||||
{
|
||||
return [
|
||||
'admin' => self::OP_INSERT,
|
||||
'api' => self::OP_INSERT | self::OP_UPDATE | self::OP_DELETE,
|
||||
// the above is equivalent to the following:
|
||||
// 'api' => self::OP_ALL,
|
||||
];
|
||||
public function transactions()
|
||||
{
|
||||
return [
|
||||
'admin' => self::OP_INSERT,
|
||||
'api' => self::OP_INSERT | self::OP_UPDATE | self::OP_DELETE,
|
||||
// the above is equivalent to the following:
|
||||
// 'api' => self::OP_ALL,
|
||||
];
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
In the above `admin` and `api` are model scenarios and constants starting with `OP_` are operations that should
|
||||
|
Reference in New Issue
Block a user