Skip to content

Commit bde4dc7

Browse files
dev
1 parent 94841e9 commit bde4dc7

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/models/ShopCollection.php

+11
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
* @property ShopBrand $brand
5252
* @property CmsStorageFile $image
5353
* @property CmsStorageFile[] $images
54+
* @property ShopProduct[] $shopProducts
5455
*
5556
* @author Semenov Alexander <semenov@skeeks.com>
5657
*/
@@ -254,6 +255,16 @@ public function getImages()
254255
->orderBy(['priority' => SORT_ASC]);
255256
}
256257

258+
/**
259+
* @return \yii\db\ActiveQuery
260+
* @throws \yii\base\InvalidConfigException
261+
*/
262+
public function getShopProducts()
263+
{
264+
return $this->hasMany(ShopProduct::class, ['id' => 'shop_product_id'])
265+
->viaTable('shop_product2collection', ['shop_collection_id' => 'id']);
266+
}
267+
257268
/**
258269
* @return \yii\db\ActiveQuery
259270
*/

0 commit comments

Comments
 (0)