1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace app\models; |
4
|
|
|
|
5
|
|
|
use Yii; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* This is the model class for table "account_category". |
9
|
|
|
* |
10
|
|
|
* @property int $account_id |
11
|
|
|
* @property int $category_id |
12
|
|
|
* @property int $user_id |
13
|
|
|
* |
14
|
|
|
* @property Account $account |
15
|
|
|
* @property Category $category |
16
|
|
|
* @property User $user |
17
|
|
|
*/ |
18
|
|
|
class AccountCategory extends \yii\db\ActiveRecord |
19
|
|
|
{ |
20
|
|
|
/** |
21
|
|
|
* {@inheritdoc} |
22
|
|
|
*/ |
23
|
|
|
public static function tableName() |
24
|
|
|
{ |
25
|
|
|
return 'account_category'; |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* {@inheritdoc} |
30
|
|
|
*/ |
31
|
|
|
public function rules() |
32
|
|
|
{ |
33
|
|
|
return [ |
34
|
|
|
[['account_id', 'category_id', 'user_id'], 'required'], |
35
|
|
|
[['account_id', 'category_id', 'user_id'], 'integer'], |
36
|
|
|
[['account_id', 'category_id', 'user_id'], 'unique', 'targetAttribute' => ['account_id', 'category_id', 'user_id']], |
37
|
|
|
[['account_id'], 'exist', 'skipOnError' => true, 'targetClass' => Account::className(), 'targetAttribute' => ['account_id' => 'id']], |
|
|
|
|
38
|
|
|
[['category_id'], 'exist', 'skipOnError' => true, 'targetClass' => Category::className(), 'targetAttribute' => ['category_id' => 'id']], |
|
|
|
|
39
|
|
|
[['user_id'], 'exist', 'skipOnError' => true, 'targetClass' => User::className(), 'targetAttribute' => ['user_id' => 'id']], |
|
|
|
|
40
|
|
|
]; |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* {@inheritdoc} |
45
|
|
|
*/ |
46
|
|
|
public function attributeLabels() |
47
|
|
|
{ |
48
|
|
|
return [ |
49
|
|
|
'account_id' => Yii::t('app', 'Account ID'), |
50
|
|
|
'category_id' => Yii::t('app', 'Category ID'), |
51
|
|
|
'user_id' => Yii::t('app', 'User ID'), |
52
|
|
|
]; |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @return \yii\db\ActiveQuery |
57
|
|
|
*/ |
58
|
|
|
public function getAccount() |
59
|
|
|
{ |
60
|
|
|
return $this->hasOne(Account::className(), ['id' => 'account_id']); |
|
|
|
|
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* @return \yii\db\ActiveQuery |
65
|
|
|
*/ |
66
|
|
|
public function getCategory() |
67
|
|
|
{ |
68
|
|
|
return $this->hasOne(Category::className(), ['id' => 'category_id']); |
|
|
|
|
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* @return \yii\db\ActiveQuery |
73
|
|
|
*/ |
74
|
|
|
public function getUser() |
75
|
|
|
{ |
76
|
|
|
return $this->hasOne(User::className(), ['id' => 'user_id']); |
|
|
|
|
77
|
|
|
} |
78
|
|
|
} |
79
|
|
|
|
This function has been deprecated. The supplier of the function has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.