Total Complexity | 6 |
Total Lines | 71 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
18 | class Position extends ActiveRecord |
||
19 | { |
||
20 | use MultilanguageTrait; |
||
|
|||
21 | |||
22 | /** |
||
23 | * {@inheritdoc} |
||
24 | */ |
||
25 | public static function tableName() |
||
26 | { |
||
27 | return 'positions'; |
||
28 | } |
||
29 | |||
30 | /** |
||
31 | * {@inheritdoc} |
||
32 | */ |
||
33 | public function rules() |
||
34 | { |
||
35 | return [ |
||
36 | [ |
||
37 | [ |
||
38 | 'created_at', |
||
39 | 'updated_at' |
||
40 | ], |
||
41 | 'safe' |
||
42 | ], |
||
43 | ]; |
||
44 | } |
||
45 | |||
46 | /** |
||
47 | * {@inheritdoc} |
||
48 | */ |
||
49 | public function attributeLabels() |
||
50 | { |
||
51 | return [ |
||
52 | 'id' => 'ID', |
||
53 | 'created_at' => Yii::t('app', 'Created date'), |
||
54 | 'updated_at' => Yii::t('app', 'Updated date'), |
||
55 | ]; |
||
56 | } |
||
57 | |||
58 | /** |
||
59 | * @return \yii\db\ActiveQuery |
||
60 | */ |
||
61 | public function getPositionsLanguages() |
||
62 | { |
||
63 | return $this->hasMany(PositionLanguage::class, [ |
||
64 | 'positions_id' => 'id' |
||
65 | ]); |
||
66 | } |
||
67 | |||
68 | /** |
||
69 | * @return \yii\db\ActiveQuery |
||
70 | */ |
||
71 | public function getLanguages() |
||
72 | { |
||
73 | return $this->hasMany(Language::class, [ |
||
74 | 'id' => 'language_id' |
||
75 | ])->viaTable('positions_language', [ |
||
76 | 'positions_id' => 'id' |
||
77 | ]); |
||
78 | } |
||
79 | |||
80 | /** |
||
81 | * @return array|\yii\db\ActiveRecord[] |
||
82 | */ |
||
83 | public static function getPositions() |
||
89 | } |
||
90 | } |
||
91 |