Passed
Push — master ( b2168e...f1daef )
by Paweł
03:26
created

AccountCategory::getUser()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
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']],
0 ignored issues
show
Deprecated Code introduced by
The function yii\base\BaseObject::className() has been deprecated: since 2.0.14. On PHP >=5.5, use `::class` instead. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

37
            [['account_id'], 'exist', 'skipOnError' => true, 'targetClass' => /** @scrutinizer ignore-deprecated */ Account::className(), 'targetAttribute' => ['account_id' => 'id']],

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.

Loading history...
38
            [['category_id'], 'exist', 'skipOnError' => true, 'targetClass' => Category::className(), 'targetAttribute' => ['category_id' => 'id']],
0 ignored issues
show
Deprecated Code introduced by
The function yii\base\BaseObject::className() has been deprecated: since 2.0.14. On PHP >=5.5, use `::class` instead. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

38
            [['category_id'], 'exist', 'skipOnError' => true, 'targetClass' => /** @scrutinizer ignore-deprecated */ Category::className(), 'targetAttribute' => ['category_id' => 'id']],

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.

Loading history...
39
            [['user_id'], 'exist', 'skipOnError' => true, 'targetClass' => User::className(), 'targetAttribute' => ['user_id' => 'id']],
0 ignored issues
show
Deprecated Code introduced by
The function yii\base\BaseObject::className() has been deprecated: since 2.0.14. On PHP >=5.5, use `::class` instead. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

39
            [['user_id'], 'exist', 'skipOnError' => true, 'targetClass' => /** @scrutinizer ignore-deprecated */ User::className(), 'targetAttribute' => ['user_id' => 'id']],

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.

Loading history...
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']);
0 ignored issues
show
Deprecated Code introduced by
The function yii\base\BaseObject::className() has been deprecated: since 2.0.14. On PHP >=5.5, use `::class` instead. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

60
        return $this->hasOne(/** @scrutinizer ignore-deprecated */ Account::className(), ['id' => 'account_id']);

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.

Loading history...
61
    }
62
63
    /**
64
     * @return \yii\db\ActiveQuery
65
     */
66
    public function getCategory()
67
    {
68
        return $this->hasOne(Category::className(), ['id' => 'category_id']);
0 ignored issues
show
Deprecated Code introduced by
The function yii\base\BaseObject::className() has been deprecated: since 2.0.14. On PHP >=5.5, use `::class` instead. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

68
        return $this->hasOne(/** @scrutinizer ignore-deprecated */ Category::className(), ['id' => 'category_id']);

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.

Loading history...
69
    }
70
71
    /**
72
     * @return \yii\db\ActiveQuery
73
     */
74
    public function getUser()
75
    {
76
        return $this->hasOne(User::className(), ['id' => 'user_id']);
0 ignored issues
show
Deprecated Code introduced by
The function yii\base\BaseObject::className() has been deprecated: since 2.0.14. On PHP >=5.5, use `::class` instead. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

76
        return $this->hasOne(/** @scrutinizer ignore-deprecated */ User::className(), ['id' => 'user_id']);

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.

Loading history...
77
    }
78
}
79