ProductOptionCompl.php
3.9 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_compl".
*
* @property integer $product_option_group_compl_id
*
* @property ProductOptionGroupCompl $productOptionGroupCompl
* @property ProductOptionComplLang[] $productOptionComplLangs
* @property Language[] $languages
* @property ProductOptionComplToCategory[] $productOptionComplToCategories
* @property Category[] $categories
* @property ProductToProductOptionCompl[] $productToProductOptionCompls
* @property Product[] $products
*/
class ProductOptionCompl extends Option
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'product_option_compl';
}
/**
* @return \yii\db\ActiveQuery
*/
public function getProductOptionGroupCompl()
{
return $this->hasOne(ProductOptionGroupCompl::className(), [ 'id' => 'product_option_group_compl_id' ])
->inverseOf('productOptionCompls');
}
/**
* @return \yii\db\ActiveQuery
*/
public function getProductOptionComplLangs()
{
return $this->hasMany(ProductOptionComplLang::className(), [ 'product_option_compl_id' => 'id' ])
->inverseOf('productOptionCompl');
}
/**
* @return \yii\db\ActiveQuery
*/
public function getLanguages()
{
return $this->hasMany(Language::className(), [ 'id' => 'language_id' ])
->viaTable('product_option_compl_lang', [ 'product_option_compl_id' => 'id' ]);
}
/**
* @return \yii\db\ActiveQuery
*/
public function getProductOptionComplToCategories()
{
return $this->hasMany(ProductOptionComplToCategory::className(), [ 'product_option_compl_id' => 'id' ])
->inverseOf('productOptionCompl');
}
/**
* @return \yii\db\ActiveQuery
*/
public function getCategories()
{
return $this->hasMany(Category::className(), [ 'id' => 'category_id' ])
->viaTable('product_option_compl_to_category', [ 'product_option_compl_id' => 'id' ]);
}
/**
* @return \yii\db\ActiveQuery
*/
public function getProductToProductOptionCompls()
{
return $this->hasMany(ProductToProductOptionCompl::className(), [ 'product_option_compl_id' => 'id' ])
->inverseOf('productOptionCompl');
}
/**
* @return \yii\db\ActiveQuery
*/
public function getProducts()
{
return $this->hasMany(Product::className(), [ 'id' => 'product_id' ])
->viaTable('product_to_product_option_compl', [ 'product_option_compl_id' => 'id' ]);
}
/**
* Get exact Option Group id value
*
* @return int|null
*/
public function getGroupId()
{
return $this->product_option_group_compl_id;
}
/**
* Set Option Group link to Option model
*
* @param int $id
*
* @return void
*/
public function setGroupId(int $id)
{
$this->product_option_group_compl_id = $id;
}
/**
* Get Group query
*
* @return \yii\db\ActiveQuery
*/
public function getGroup(): ActiveQuery
{
return $this->getProductOptionGroupCompl()
->inverseOf('options');
}
}