1
0
Fork 0
mirror of https://github.com/Oreolek/yii2-nested-sets.git synced 2024-06-26 11:40:47 +03:00
yii2-nested-sets/tests/models/Tree.php
2015-01-05 11:03:13 +03:00

69 lines
1.1 KiB
PHP

<?php
/**
* @link https://github.com/creocoder/yii2-nested-sets
* @copyright Copyright (c) 2015 Alexander Kochetov
* @license http://opensource.org/licenses/BSD-3-Clause
*/
namespace tests\models;
use creocoder\nestedsets\NestedSetsBehavior;
/**
* Tree
*
* @property integer $id
* @property integer $lft
* @property integer $rgt
* @property integer $depth
* @property string $name
*/
class Tree extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'tree';
}
/**
* @inheritdoc
*/
public function behaviors()
{
return [
NestedSetsBehavior::className(),
];
}
/**
* @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 TreeQuery(get_called_class());
}
}