Commit 44799a6cecf4de70535a237f24a9f1dd60b61d9a
1 parent
4e9a257c
add variantSku
Showing
3 changed files
with
5 additions
and
5 deletions
Show diff stats
models/Category.php
... | ... | @@ -151,7 +151,7 @@ |
151 | 151 | */ |
152 | 152 | public function getProductUnit() |
153 | 153 | { |
154 | - return $this->hasOne(ProductUnit::className(), [ 'id' => 'product_unit_id' ]); | |
154 | + return $this->hasOne(ProductUnit::className(), [ 'id' => 'product_unit_id' ])->inverseOf('product'); | |
155 | 155 | } |
156 | 156 | |
157 | 157 | /** |
... | ... | @@ -160,7 +160,7 @@ |
160 | 160 | public function getProducts() |
161 | 161 | { |
162 | 162 | return $this->hasMany(Product::className(), [ 'id' => 'product_id' ]) |
163 | - ->viaTable('product_category', [ 'category_id' => 'id' ]); | |
163 | + ->viaTable('product_category', [ 'category_id' => 'id' ])->inverseOf('categories'); | |
164 | 164 | } |
165 | 165 | |
166 | 166 | /** |
... | ... | @@ -318,7 +318,7 @@ |
318 | 318 | public function getTaxGroups() |
319 | 319 | { |
320 | 320 | return $this->hasMany(TaxGroup::className(), [ 'id' => 'tax_group_id' ]) |
321 | - ->viaTable('tax_group_to_category', [ 'category_id' => 'id' ]); | |
321 | + ->viaTable('tax_group_to_category', [ 'category_id' => 'id' ])->inverseOf('categories'); | |
322 | 322 | } |
323 | 323 | |
324 | 324 | /** | ... | ... |
models/Product.php
... | ... | @@ -429,7 +429,7 @@ |
429 | 429 | public function getCategories() |
430 | 430 | { |
431 | 431 | return $this->hasMany(Category::className(), [ 'id' => 'category_id' ]) |
432 | - ->viaTable('product_category', [ 'product_id' => 'id' ]); | |
432 | + ->viaTable('product_category', [ 'product_id' => 'id' ])->inverseOf('products'); | |
433 | 433 | } |
434 | 434 | |
435 | 435 | /** | ... | ... |
models/TaxGroup.php
... | ... | @@ -138,7 +138,7 @@ |
138 | 138 | public function getCategories() |
139 | 139 | { |
140 | 140 | return $this->hasMany(Category::className(), [ 'id' => 'category_id' ]) |
141 | - ->viaTable('tax_group_to_category', [ 'tax_group_id' => 'id' ]); | |
141 | + ->viaTable('tax_group_to_category', [ 'tax_group_id' => 'id' ])->inverseOf('taxGroups'); | |
142 | 142 | } |
143 | 143 | |
144 | 144 | /** | ... | ... |