@@ 26-145 (lines=120) @@ | ||
23 | * |
|
24 | * @package app\models |
|
25 | */ |
|
26 | class AboutLanguage extends ActiveRecord |
|
27 | { |
|
28 | /** |
|
29 | * {@inheritdoc} |
|
30 | */ |
|
31 | public static function tableName() |
|
32 | { |
|
33 | return 'about_language'; |
|
34 | } |
|
35 | ||
36 | /** |
|
37 | * {@inheritdoc} |
|
38 | */ |
|
39 | public function rules() |
|
40 | { |
|
41 | return [ |
|
42 | [ |
|
43 | [ |
|
44 | 'about_id', |
|
45 | 'language_id', |
|
46 | ], |
|
47 | 'required' |
|
48 | ], |
|
49 | [ |
|
50 | [ |
|
51 | 'about_id', |
|
52 | 'language_id' |
|
53 | ], |
|
54 | 'integer' |
|
55 | ], |
|
56 | [ |
|
57 | [ |
|
58 | 'description', |
|
59 | 'content' |
|
60 | ], |
|
61 | 'string' |
|
62 | ], |
|
63 | [ |
|
64 | [ |
|
65 | 'created_at', |
|
66 | 'updated_at' |
|
67 | ], |
|
68 | 'safe' |
|
69 | ], |
|
70 | [ |
|
71 | [ |
|
72 | 'title', |
|
73 | 'metaKeys', |
|
74 | 'metaDescription' |
|
75 | ], |
|
76 | 'string', |
|
77 | 'max' => 255 |
|
78 | ], |
|
79 | [ |
|
80 | [ |
|
81 | 'about_id', |
|
82 | 'language_id' |
|
83 | ], |
|
84 | 'unique', |
|
85 | 'targetAttribute' => ['about_id', 'language_id'] |
|
86 | ], |
|
87 | [ |
|
88 | [ |
|
89 | 'about_id' |
|
90 | ], |
|
91 | 'exist', |
|
92 | 'skipOnError' => true, |
|
93 | 'targetClass' => About::class, |
|
94 | 'targetAttribute' => ['about_id' => 'id'] |
|
95 | ], |
|
96 | [ |
|
97 | [ |
|
98 | 'language_id' |
|
99 | ], |
|
100 | 'exist', |
|
101 | 'skipOnError' => true, |
|
102 | 'targetClass' => Language::class, |
|
103 | 'targetAttribute' => ['language_id' => 'id'] |
|
104 | ], |
|
105 | ]; |
|
106 | } |
|
107 | ||
108 | /** |
|
109 | * {@inheritdoc} |
|
110 | */ |
|
111 | public function attributeLabels() |
|
112 | { |
|
113 | return [ |
|
114 | 'about_id' => 'About ID', |
|
115 | 'language_id' => 'Language ID', |
|
116 | 'title' => Yii::t('app', 'Title'), |
|
117 | 'description' => Yii::t('app', 'Description'), |
|
118 | 'content' => Yii::t('app', 'Content'), |
|
119 | 'metaKeys' => Yii::t('app', 'Meta keys'), |
|
120 | 'metaDescription' => Yii::t('app', 'Meta description'), |
|
121 | 'created_at' => Yii::t('app', 'Created date'), |
|
122 | 'updated_at' => Yii::t('app', 'Updated date'), |
|
123 | ]; |
|
124 | } |
|
125 | ||
126 | /** |
|
127 | * @return \yii\db\ActiveQuery |
|
128 | */ |
|
129 | public function getAbout() |
|
130 | { |
|
131 | return $this->hasOne(About::class, [ |
|
132 | 'id' => 'about_id' |
|
133 | ]); |
|
134 | } |
|
135 | ||
136 | /** |
|
137 | * @return \yii\db\ActiveQuery |
|
138 | */ |
|
139 | public function getLanguage() |
|
140 | { |
|
141 | return $this->hasOne(Language::class, [ |
|
142 | 'id' => 'language_id' |
|
143 | ]); |
|
144 | } |
|
145 | } |
|
146 |
@@ 26-145 (lines=120) @@ | ||
23 | * |
|
24 | * @package app\models |
|
25 | */ |
|
26 | class ArticleLanguage extends ActiveRecord |
|
27 | { |
|
28 | /** |
|
29 | * {@inheritdoc} |
|
30 | */ |
|
31 | public static function tableName() |
|
32 | { |
|
33 | return 'articles_language'; |
|
34 | } |
|
35 | ||
36 | /** |
|
37 | * {@inheritdoc} |
|
38 | */ |
|
39 | public function rules() |
|
40 | { |
|
41 | return [ |
|
42 | [ |
|
43 | [ |
|
44 | 'articles_id', |
|
45 | 'language_id' |
|
46 | ], |
|
47 | 'required' |
|
48 | ], |
|
49 | [ |
|
50 | [ |
|
51 | 'articles_id', |
|
52 | 'language_id' |
|
53 | ], |
|
54 | 'integer' |
|
55 | ], |
|
56 | [ |
|
57 | [ |
|
58 | 'description', |
|
59 | 'content' |
|
60 | ], |
|
61 | 'string' |
|
62 | ], |
|
63 | [ |
|
64 | [ |
|
65 | 'created_at', |
|
66 | 'updated_at' |
|
67 | ], |
|
68 | 'safe' |
|
69 | ], |
|
70 | [ |
|
71 | [ |
|
72 | 'title', |
|
73 | 'metaKeys', |
|
74 | 'metaDescription' |
|
75 | ], |
|
76 | 'string', |
|
77 | 'max' => 255 |
|
78 | ], |
|
79 | [ |
|
80 | [ |
|
81 | 'articles_id', |
|
82 | 'language_id' |
|
83 | ], |
|
84 | 'unique', |
|
85 | 'targetAttribute' => ['articles_id', 'language_id'] |
|
86 | ], |
|
87 | [ |
|
88 | [ |
|
89 | 'language_id' |
|
90 | ], |
|
91 | 'exist', |
|
92 | 'skipOnError' => true, |
|
93 | 'targetClass' => Language::class, |
|
94 | 'targetAttribute' => ['language_id' => 'id'] |
|
95 | ], |
|
96 | [ |
|
97 | [ |
|
98 | 'articles_id' |
|
99 | ], |
|
100 | 'exist', |
|
101 | 'skipOnError' => true, |
|
102 | 'targetClass' => Article::class, |
|
103 | 'targetAttribute' => ['articles_id' => 'id'] |
|
104 | ], |
|
105 | ]; |
|
106 | } |
|
107 | ||
108 | /** |
|
109 | * {@inheritdoc} |
|
110 | */ |
|
111 | public function attributeLabels() |
|
112 | { |
|
113 | return [ |
|
114 | 'articles_id' => 'Article ID', |
|
115 | 'language_id' => 'Language ID', |
|
116 | 'title' => Yii::t('app', 'Title'), |
|
117 | 'description' => Yii::t('app', 'Description'), |
|
118 | 'content' => Yii::t('app', 'Content'), |
|
119 | 'metaKeys' => Yii::t('app', 'Meta keys'), |
|
120 | 'metaDescription' => Yii::t('app', 'Meta description'), |
|
121 | 'created_at' => Yii::t('app', 'Created date'), |
|
122 | 'updated_at' => Yii::t('app', 'Updated date'), |
|
123 | ]; |
|
124 | } |
|
125 | ||
126 | /** |
|
127 | * @return \yii\db\ActiveQuery |
|
128 | */ |
|
129 | public function getLanguage() |
|
130 | { |
|
131 | return $this->hasOne(Language::class, [ |
|
132 | 'id' => 'language_id' |
|
133 | ]); |
|
134 | } |
|
135 | ||
136 | /** |
|
137 | * @return \yii\db\ActiveQuery |
|
138 | */ |
|
139 | public function getArticle() |
|
140 | { |
|
141 | return $this->hasOne(Article::class, [ |
|
142 | 'id' => 'articles_id' |
|
143 | ]); |
|
144 | } |
|
145 | } |
|
146 |
@@ 26-145 (lines=120) @@ | ||
23 | * |
|
24 | * @package app\models |
|
25 | */ |
|
26 | class HomeLanguage extends ActiveRecord |
|
27 | { |
|
28 | /** |
|
29 | * {@inheritdoc} |
|
30 | */ |
|
31 | public static function tableName() |
|
32 | { |
|
33 | return 'home_language'; |
|
34 | } |
|
35 | ||
36 | /** |
|
37 | * {@inheritdoc} |
|
38 | */ |
|
39 | public function rules() |
|
40 | { |
|
41 | return [ |
|
42 | [ |
|
43 | [ |
|
44 | 'home_id', |
|
45 | 'language_id' |
|
46 | ], |
|
47 | 'required' |
|
48 | ], |
|
49 | [ |
|
50 | [ |
|
51 | 'home_id', |
|
52 | 'language_id' |
|
53 | ], |
|
54 | 'integer' |
|
55 | ], |
|
56 | [ |
|
57 | [ |
|
58 | 'description', |
|
59 | 'content' |
|
60 | ], |
|
61 | 'string' |
|
62 | ], |
|
63 | [ |
|
64 | [ |
|
65 | 'created_at', |
|
66 | 'updated_at' |
|
67 | ], |
|
68 | 'safe' |
|
69 | ], |
|
70 | [ |
|
71 | [ |
|
72 | 'title', |
|
73 | 'metaKeys', |
|
74 | 'metaDescription' |
|
75 | ], |
|
76 | 'string', |
|
77 | 'max' => 255 |
|
78 | ], |
|
79 | [ |
|
80 | [ |
|
81 | 'home_id', |
|
82 | 'language_id' |
|
83 | ], |
|
84 | 'unique', |
|
85 | 'targetAttribute' => ['home_id', 'language_id'] |
|
86 | ], |
|
87 | [ |
|
88 | [ |
|
89 | 'home_id' |
|
90 | ], |
|
91 | 'exist', |
|
92 | 'skipOnError' => true, |
|
93 | 'targetClass' => Home::class, |
|
94 | 'targetAttribute' => ['home_id' => 'id'] |
|
95 | ], |
|
96 | [ |
|
97 | [ |
|
98 | 'language_id' |
|
99 | ], |
|
100 | 'exist', |
|
101 | 'skipOnError' => true, |
|
102 | 'targetClass' => Language::class, |
|
103 | 'targetAttribute' => ['language_id' => 'id'] |
|
104 | ], |
|
105 | ]; |
|
106 | } |
|
107 | ||
108 | /** |
|
109 | * {@inheritdoc} |
|
110 | */ |
|
111 | public function attributeLabels() |
|
112 | { |
|
113 | return [ |
|
114 | 'home_id' => 'Home ID', |
|
115 | 'language_id' => 'Language ID', |
|
116 | 'title' => Yii::t('app', 'Title'), |
|
117 | 'description' => Yii::t('app', 'Description'), |
|
118 | 'content' => Yii::t('app', 'Content'), |
|
119 | 'metaKeys' => Yii::t('app', 'Meta keys'), |
|
120 | 'metaDescription' => Yii::t('app', 'Meta description'), |
|
121 | 'created_at' => Yii::t('app', 'Created date'), |
|
122 | 'updated_at' => Yii::t('app', 'Updated date'), |
|
123 | ]; |
|
124 | } |
|
125 | ||
126 | /** |
|
127 | * @return \yii\db\ActiveQuery |
|
128 | */ |
|
129 | public function getHome() |
|
130 | { |
|
131 | return $this->hasOne(Home::class, [ |
|
132 | 'id' => 'home_id' |
|
133 | ]); |
|
134 | } |
|
135 | ||
136 | /** |
|
137 | * @return \yii\db\ActiveQuery |
|
138 | */ |
|
139 | public function getLanguage() |
|
140 | { |
|
141 | return $this->hasOne(Language::class, [ |
|
142 | 'id' => 'language_id' |
|
143 | ]); |
|
144 | } |
|
145 | } |
|
146 |
@@ 26-145 (lines=120) @@ | ||
23 | * |
|
24 | * @package app\models |
|
25 | */ |
|
26 | class ProductLanguage extends ActiveRecord |
|
27 | { |
|
28 | /** |
|
29 | * {@inheritdoc} |
|
30 | */ |
|
31 | public static function tableName() |
|
32 | { |
|
33 | return 'products_language'; |
|
34 | } |
|
35 | ||
36 | /** |
|
37 | * {@inheritdoc} |
|
38 | */ |
|
39 | public function rules() |
|
40 | { |
|
41 | return [ |
|
42 | [ |
|
43 | [ |
|
44 | 'products_id', |
|
45 | 'language_id' |
|
46 | ], |
|
47 | 'required' |
|
48 | ], |
|
49 | [ |
|
50 | [ |
|
51 | 'products_id', |
|
52 | 'language_id' |
|
53 | ], |
|
54 | 'integer' |
|
55 | ], |
|
56 | [ |
|
57 | [ |
|
58 | 'description', |
|
59 | 'content' |
|
60 | ], |
|
61 | 'string' |
|
62 | ], |
|
63 | [ |
|
64 | [ |
|
65 | 'created_at', |
|
66 | 'updated_at' |
|
67 | ], |
|
68 | 'safe' |
|
69 | ], |
|
70 | [ |
|
71 | [ |
|
72 | 'title', |
|
73 | 'metaKeys', |
|
74 | 'metaDescription' |
|
75 | ], |
|
76 | 'string', |
|
77 | 'max' => 255 |
|
78 | ], |
|
79 | [ |
|
80 | [ |
|
81 | 'products_id', |
|
82 | 'language_id' |
|
83 | ], |
|
84 | 'unique', |
|
85 | 'targetAttribute' => ['products_id', 'language_id'] |
|
86 | ], |
|
87 | [ |
|
88 | [ |
|
89 | 'language_id' |
|
90 | ], |
|
91 | 'exist', |
|
92 | 'skipOnError' => true, |
|
93 | 'targetClass' => Language::class, |
|
94 | 'targetAttribute' => ['language_id' => 'id'] |
|
95 | ], |
|
96 | [ |
|
97 | [ |
|
98 | 'products_id' |
|
99 | ], |
|
100 | 'exist', |
|
101 | 'skipOnError' => true, |
|
102 | 'targetClass' => Product::class, |
|
103 | 'targetAttribute' => ['products_id' => 'id'] |
|
104 | ], |
|
105 | ]; |
|
106 | } |
|
107 | ||
108 | /** |
|
109 | * {@inheritdoc} |
|
110 | */ |
|
111 | public function attributeLabels() |
|
112 | { |
|
113 | return [ |
|
114 | 'products_id' => 'Products ID', |
|
115 | 'language_id' => 'Language ID', |
|
116 | 'title' => Yii::t('app', 'Title'), |
|
117 | 'description' => Yii::t('app', 'Description'), |
|
118 | 'content' => Yii::t('app', 'Content'), |
|
119 | 'metaKeys' => Yii::t('app', 'Meta keys'), |
|
120 | 'metaDescription' => Yii::t('app', 'Meta description'), |
|
121 | 'created_at' => Yii::t('app', 'Created date'), |
|
122 | 'updated_at' => Yii::t('app', 'Updated date'), |
|
123 | ]; |
|
124 | } |
|
125 | ||
126 | /** |
|
127 | * @return \yii\db\ActiveQuery |
|
128 | */ |
|
129 | public function getLanguage() |
|
130 | { |
|
131 | return $this->hasOne(Language::class, [ |
|
132 | 'id' => 'language_id' |
|
133 | ]); |
|
134 | } |
|
135 | ||
136 | /** |
|
137 | * @return \yii\db\ActiveQuery |
|
138 | */ |
|
139 | public function getProduct() |
|
140 | { |
|
141 | return $this->hasOne(Product::class, [ |
|
142 | 'id' => 'products_id' |
|
143 | ]); |
|
144 | } |
|
145 | } |
|
146 |