-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathAuthAssignment.php
92 lines (84 loc) · 2.68 KB
/
AuthAssignment.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
/************************************************************************************
*
* Copyright (c) 2018 Thanasis Vergoulis & Konstantinos Zagganas & Loukas Kavouras
* for the Information Management Systems Institute, "Athena" Research Center.
*
* This file is part of SCHeMa.
*
* SCHeMa is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* SCHeMa is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Foobar. If not, see <https://www.gnu.org/licenses/>.
*
************************************************************************************/
namespace app\models;
use Yii;
/**
* This is the model class for table "auth_assignment".
*
* @property string $item_name
* @property int $user_id
* @property int $created_at
*
* @property AuthItem $itemName
* @property User $user
*/
class AuthAssignment extends \yii\db\ActiveRecord
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'auth_assignment';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['item_name', 'user_id'], 'required'],
[['user_id', 'created_at'], 'default', 'value' => null],
[['user_id', 'created_at'], 'integer'],
[['item_name'], 'string', 'max' => 64],
[['item_name', 'user_id'], 'unique', 'targetAttribute' => ['item_name', 'user_id']],
[['item_name'], 'exist', 'skipOnError' => true, 'targetClass' => AuthItem::className(), 'targetAttribute' => ['item_name' => 'name']],
[['user_id'], 'exist', 'skipOnError' => true, 'targetClass' => User::className(), 'targetAttribute' => ['user_id' => 'id']],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels()
{
return [
'item_name' => 'Item Name',
'user_id' => 'User ID',
'created_at' => 'Created At',
];
}
/**
* @return \yii\db\ActiveQuery
*/
public function getItemName()
{
return $this->hasOne(AuthItem::className(), ['name' => 'item_name']);
}
/**
* @return \yii\db\ActiveQuery
*/
public function getUser()
{
return $this->hasOne(User::className(), ['id' => 'user_id']);
}
}