Commit 4e9f8bd5 by Alexander Makarov

Fixed example of transactional operations in AR guide

parent dd61be67
...@@ -969,12 +969,16 @@ as described in "transactions" section of "[Database basics](db-dao.md)". Anothe ...@@ -969,12 +969,16 @@ as described in "transactions" section of "[Database basics](db-dao.md)". Anothe
```php ```php
class Post extends \yii\db\ActiveRecord class Post extends \yii\db\ActiveRecord
{ {
public function transactions()
{
return [ return [
'admin' => self::OP_INSERT, 'admin' => self::OP_INSERT,
'api' => self::OP_INSERT | self::OP_UPDATE | self::OP_DELETE, 'api' => self::OP_INSERT | self::OP_UPDATE | self::OP_DELETE,
// the above is equivalent to the following: // the above is equivalent to the following:
// 'api' => self::OP_ALL, // 'api' => self::OP_ALL,
]; ];
}
}
``` ```
In the above `admin` and `api` are model scenarios and constants starting with `OP_` are operations that should In the above `admin` and `api` are model scenarios and constants starting with `OP_` are operations that should
......
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