Commit 5410d5a09b69cf923dcf4a4a4a9fbb8bbf75d14f
1 parent
5612f75b
Video and blog
Showing
3 changed files
with
10 additions
and
51 deletions
Show diff stats
models/BlogArticle.php
@@ -27,6 +27,7 @@ | @@ -27,6 +27,7 @@ | ||
27 | * @property BlogArticle[] $relatedBlogArticles | 27 | * @property BlogArticle[] $relatedBlogArticles |
28 | * @property BlogArticle[] $blogArticles | 28 | * @property BlogArticle[] $blogArticles |
29 | * @property BlogCategory[] $blogCategories | 29 | * @property BlogCategory[] $blogCategories |
30 | + * @property BlogCategory $blogCategory | ||
30 | * @property Product[] $products | 31 | * @property Product[] $products |
31 | * @property BlogTag[] $blogTags | 32 | * @property BlogTag[] $blogTags |
32 | * * * From language behavior * | 33 | * * * From language behavior * |
@@ -134,23 +135,6 @@ | @@ -134,23 +135,6 @@ | ||
134 | /** | 135 | /** |
135 | * @return \yii\db\ActiveQuery | 136 | * @return \yii\db\ActiveQuery |
136 | */ | 137 | */ |
137 | - public function getBlogArticleLangs() | ||
138 | - { | ||
139 | - return $this->hasMany(BlogArticleLang::className(), [ 'blog_article_id' => 'id' ]); | ||
140 | - } | ||
141 | - | ||
142 | - /** | ||
143 | - * @return \yii\db\ActiveQuery | ||
144 | - */ | ||
145 | - public function getLanguages() | ||
146 | - { | ||
147 | - return $this->hasMany(Language::className(), [ 'id' => 'language_id' ]) | ||
148 | - ->viaTable('blog_article_lang', [ 'blog_article_id' => 'id' ]); | ||
149 | - } | ||
150 | - | ||
151 | - /** | ||
152 | - * @return \yii\db\ActiveQuery | ||
153 | - */ | ||
154 | public function getRelatedBlogArticles() | 138 | public function getRelatedBlogArticles() |
155 | { | 139 | { |
156 | return $this->hasMany(BlogArticle::className(), [ 'id' => 'related_blog_article_id' ]) | 140 | return $this->hasMany(BlogArticle::className(), [ 'id' => 'related_blog_article_id' ]) |
@@ -178,6 +162,15 @@ | @@ -178,6 +162,15 @@ | ||
178 | /** | 162 | /** |
179 | * @return \yii\db\ActiveQuery | 163 | * @return \yii\db\ActiveQuery |
180 | */ | 164 | */ |
165 | + public function getBlogCategory() | ||
166 | + { | ||
167 | + return $this->hasOne(BlogCategory::className(), [ 'id' => 'blog_category_id' ]) | ||
168 | + ->viaTable('blog_article_to_category', [ 'blog_article_id' => 'id' ]); | ||
169 | + } | ||
170 | + | ||
171 | + /** | ||
172 | + * @return \yii\db\ActiveQuery | ||
173 | + */ | ||
181 | public function getProducts() | 174 | public function getProducts() |
182 | { | 175 | { |
183 | return $this->hasMany(Product::className(), [ 'id' => 'product_id' ]) | 176 | return $this->hasMany(Product::className(), [ 'id' => 'product_id' ]) |
models/BlogCategory.php
@@ -135,23 +135,6 @@ | @@ -135,23 +135,6 @@ | ||
135 | ->viaTable('blog_article_to_category', [ 'blog_category_id' => 'id' ]); | 135 | ->viaTable('blog_article_to_category', [ 'blog_category_id' => 'id' ]); |
136 | } | 136 | } |
137 | 137 | ||
138 | - /** | ||
139 | - * @return \yii\db\ActiveQuery | ||
140 | - */ | ||
141 | - public function getBlogCategoryLangs() | ||
142 | - { | ||
143 | - return $this->hasMany(BlogCategoryLang::className(), [ 'blog_category_id' => 'id' ]); | ||
144 | - } | ||
145 | - | ||
146 | - /** | ||
147 | - * @return \yii\db\ActiveQuery | ||
148 | - */ | ||
149 | - public function getLanguages() | ||
150 | - { | ||
151 | - return $this->hasMany(Language::className(), [ 'id' => 'language_id' ]) | ||
152 | - ->viaTable('blog_category_lang', [ 'blog_category_id' => 'id' ]); | ||
153 | - } | ||
154 | - | ||
155 | public function getParent() | 138 | public function getParent() |
156 | { | 139 | { |
157 | return $this->hasOne(BlogCategory::className(), [ 'id' => 'parent_id' ]); | 140 | return $this->hasOne(BlogCategory::className(), [ 'id' => 'parent_id' ]); |
models/BlogTag.php
@@ -89,21 +89,4 @@ | @@ -89,21 +89,4 @@ | ||
89 | return $this->hasMany(BlogArticle::className(), [ 'id' => 'blog_article_id' ]) | 89 | return $this->hasMany(BlogArticle::className(), [ 'id' => 'blog_article_id' ]) |
90 | ->viaTable('blog_article_to_tag', [ 'blog_tag_id' => 'id' ]); | 90 | ->viaTable('blog_article_to_tag', [ 'blog_tag_id' => 'id' ]); |
91 | } | 91 | } |
92 | - | ||
93 | - /** | ||
94 | - * @return \yii\db\ActiveQuery | ||
95 | - */ | ||
96 | - public function getBlogTagLangs() | ||
97 | - { | ||
98 | - return $this->hasMany(BlogTagLang::className(), [ 'blog_tag_id' => 'id' ]); | ||
99 | - } | ||
100 | - | ||
101 | - /** | ||
102 | - * @return \yii\db\ActiveQuery | ||
103 | - */ | ||
104 | - public function getLanguages() | ||
105 | - { | ||
106 | - return $this->hasMany(Language::className(), [ 'id' => 'language_id' ]) | ||
107 | - ->viaTable('blog_tag_lang', [ 'blog_tag_id' => 'id' ]); | ||
108 | - } | ||
109 | } | 92 | } |