-
Notifications
You must be signed in to change notification settings - Fork 0
/
Menuitem.php
73 lines (67 loc) · 1.81 KB
/
Menuitem.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
/**
* This file is part of the mgrechanik/yii2-materialized-path library
*
* @copyright Copyright (c) Mikhail Grechanik <[email protected]>
* @license https://github.com/mgrechanik/yii2-materialized-path/blob/master/LICENCE.md
* @link https://github.com/mgrechanik/yii2-materialized-path
*/
namespace mgrechanik\yiimaterializedpath\tests\models;
use mgrechanik\yiimaterializedpath\MaterializedPathBehavior;
/**
* This is the model class for table "menuitem".
*
* It holds many trees.
*
* @property int $id
* @property int $treeid The id of the menu this menuitem belongs to
* @property string $path Path to parent node
* @property int $level Level of the node in the tree
* @property int $weight Weight among siblings
* @property string $name Name
*/
class Menuitem extends \yii\db\ActiveRecord
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'menuitem';
}
public function behaviors()
{
return [
'materializedpath' => [
'class' => MaterializedPathBehavior::class,
'treeIdentityFields' => ['treeid'],
],
];
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['name'], 'required'],
[['level', 'weight'], 'integer'],
[['path'], 'string'],
[['name'], 'string', 'max' => 255],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'treeid' => 'The id of the menu this menuitem belongs to',
'path' => 'Path to parent node',
'level' => 'Level of the node in the tree',
'weight' => 'Weight among siblings',
'name' => 'Name',
];
}
}