1
0
Fork 0
mirror of https://github.com/Oreolek/yii2-nested-sets.git synced 2024-06-26 03:30:46 +03:00
yii2-nested-sets/tests/models/MultipleRootsTree.php
2015-01-02 11:49:35 +03:00

73 lines
1.3 KiB
PHP

<?php
/**
* @link https://github.com/creocoder/yii2-nested-sets-behavior
* @copyright Copyright (c) 2015 Alexander Kochetov
* @license http://opensource.org/licenses/BSD-3-Clause
*/
namespace tests\models;
use creocoder\nestedsets\NestedSetsBehavior;
/**
* MultipleRootsTree
*
* @property integer $id
* @property integer $tree
* @property integer $lft
* @property integer $rgt
* @property integer $depth
* @property string $name
*/
class MultipleRootsTree extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'multiple_roots_tree';
}
/**
* @inheritdoc
*/
public function behaviors()
{
return [
[
'class' => NestedSetsBehavior::className(),
'treeAttribute' => 'tree',
],
];
}
/**
* @inheritdoc
*/
public function rules()
{
return [
['name', 'required'],
];
}
/**
* @inheritdoc
*/
public function transactions()
{
return [
self::SCENARIO_DEFAULT => self::OP_ALL,
];
}
/**
* @inheritdoc
*/
public static function find()
{
return new MultipleRootsTreeQuery(get_called_class());
}
}