ProductOptionExcl.php
3.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<?php
namespace artbox\catalog\models;
use artbox\core\models\Language;
use yii\db\ActiveQuery;
/**
* This is the model class for table "product_option_excl".
*
* @property integer $product_option_group_excl_id
*
* @property ProductOptionGroupExcl $productOptionGroupExcl
* @property ProductOptionExclLang[] $productOptionExclLangs
* @property Language[] $languages
* @property ProductOptionExclToCategory[] $productOptionExclToCategories
* @property Category[] $categories
* @property ProductToProductOptionExcl[] $productToProductOptionExcls
* @property Product[] $products
*/
class ProductOptionExcl extends Option
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'product_option_excl';
}
/**
* @return \yii\db\ActiveQuery
*/
public function getProductOptionGroupExcl()
{
return $this->hasOne(ProductOptionGroupExcl::className(), [ 'id' => 'product_option_group_excl_id' ])
->inverseOf('productOptionExcls');
}
/**
* @return \yii\db\ActiveQuery
*/
public function getProductOptionExclLangs()
{
return $this->hasMany(ProductOptionExclLang::className(), [ 'product_option_excl_id' => 'id' ])
->inverseOf('productOptionExcl');
}
/**
* @return \yii\db\ActiveQuery
*/
public function getLanguages()
{
return $this->hasMany(Language::className(), [ 'id' => 'language_id' ])
->viaTable('product_option_excl_lang', [ 'product_option_excl_id' => 'id' ]);
}
/**
* @return \yii\db\ActiveQuery
*/
public function getProductOptionExclToCategories()
{
return $this->hasMany(ProductOptionExclToCategory::className(), [ 'product_option_excl_id' => 'id' ])
->inverseOf('productOptionExcl');
}
/**
* @return \yii\db\ActiveQuery
*/
public function getCategories()
{
return $this->hasMany(Category::className(), [ 'id' => 'category_id' ])
->viaTable('product_option_excl_to_category', [ 'product_option_excl_id' => 'id' ]);
}
/**
* @return \yii\db\ActiveQuery
*/
public function getProductToProductOptionExcls()
{
return $this->hasMany(ProductToProductOptionExcl::className(), [ 'product_option_excl_id' => 'id' ])
->inverseOf('productOptionExcl');
}
/**
* @return \yii\db\ActiveQuery
*/
public function getProducts()
{
return $this->hasMany(Product::className(), [ 'id' => 'product_id' ])
->viaTable('product_to_product_option_excl', [ 'product_option_excl_id' => 'id' ]);
}
/**
* Get exact Option Group id value
*
* @return int|null
*/
public function getGroupId()
{
return $this->product_option_group_excl_id;
}
/**
* Set Option Group link to Option model
*
* @param int $id
*
* @return void
*/
public function setGroupId(int $id)
{
$this->product_option_group_excl_id = $id;
}
/**
* Get Group query
*
* @return \yii\db\ActiveQuery
*/
public function getGroup(): ActiveQuery
{
return $this->getProductOptionGroupExcl()
->inverseOf('options');
}
}