d8c1a2e0
Yarik
Big commit artbox
|
1
|
<?php
|
cc658b4c
Yarik
Big commit
|
2
3
4
|
namespace common\modules\rubrication\models;
|
93c267f7
Yarik
Multilanguage big...
|
5
|
use common\behaviors\SaveImgBehavior;
|
d55d2fe0
Yarik
Multilanguage
|
6
|
use common\modules\language\behaviors\LanguageBehavior;
|
cc658b4c
Yarik
Big commit
|
7
|
use common\modules\product\models\Product;
|
b7d40aed
Yarik
Another one admin...
|
8
|
use common\modules\product\models\ProductVariant;
|
cc658b4c
Yarik
Big commit
|
9
|
use Yii;
|
d55d2fe0
Yarik
Multilanguage
|
10
|
use yii\db\ActiveQuery;
|
cc658b4c
Yarik
Big commit
|
11
|
use yii\db\ActiveRecord;
|
d55d2fe0
Yarik
Multilanguage
|
12
|
use yii\web\Request;
|
93c267f7
Yarik
Multilanguage big...
|
13
|
|
d8c1a2e0
Yarik
Big commit artbox
|
14
|
/**
|
cc658b4c
Yarik
Big commit
|
15
|
* This is the model class for table "{{%tax_option}}".
|
8af13427
Yarik
For leha commit.
|
16
|
*
|
c70f24ea
Yarik
For Leha commit.
|
17
|
* @property string $id
|
b7d40aed
Yarik
Another one admin...
|
18
|
* @property integer $tax_group_id
|
b7d40aed
Yarik
Another one admin...
|
19
|
* @property integer $tree
|
b7d40aed
Yarik
Another one admin...
|
20
21
22
|
* @property integer $sort
* @property string $image
* @property TaxGroup $taxGroup
|
772a3ca4
Yarik
Big commit
|
23
|
* @property TaxGroup $group
|
b7d40aed
Yarik
Another one admin...
|
24
25
|
* @property Product[] $products
* @property ProductVariant[] $productVariants
|
d55d2fe0
Yarik
Multilanguage
|
26
|
* * From language behavior *
|
b7d40aed
Yarik
Another one admin...
|
27
28
|
* @property TaxOptionLang $lang
* @property TaxOptionLang[] $langs
|
8af13427
Yarik
For leha commit.
|
29
|
* @property TaxOptionLang $objectLang
|
b7d40aed
Yarik
Another one admin...
|
30
31
|
* @property string $ownerKey
* @property string $langKey
|
8af13427
Yarik
For leha commit.
|
32
|
* @property TaxOptionLang[] $modelLangs
|
b7d40aed
Yarik
Another one admin...
|
33
|
* @property bool $transactionStatus
|
d55d2fe0
Yarik
Multilanguage
|
34
|
* @method string getOwnerKey()
|
93c267f7
Yarik
Multilanguage big...
|
35
|
* @method void setOwnerKey( string $value )
|
d55d2fe0
Yarik
Multilanguage
|
36
|
* @method string getLangKey()
|
93c267f7
Yarik
Multilanguage big...
|
37
|
* @method void setLangKey( string $value )
|
d55d2fe0
Yarik
Multilanguage
|
38
39
40
|
* @method ActiveQuery getLangs()
* @method ActiveQuery getLang( integer $language_id )
* @method TaxOptionLang[] generateLangs()
|
72a992f5
Yarik
Import browser v1.0
|
41
42
43
44
|
* @method void loadLangs( Request $request )
* @method bool linkLangs()
* @method bool saveLangs()
* @method bool getTransactionStatus()
|
d55d2fe0
Yarik
Multilanguage
|
45
|
* * End language behavior *
|
5c2eb7c8
Yarik
Big commit almost...
|
46
47
48
49
50
51
|
* * From SaveImgBehavior
* @property string|null $imageFile
* @property string|null $imageUrl
* @method string|null getImageFile( int $field )
* @method string|null getImageUrl( int $field )
* * End SaveImgBehavior
|
d8c1a2e0
Yarik
Big commit artbox
|
52
|
*/
|
72a992f5
Yarik
Import browser v1.0
|
53
|
class TaxOption extends ActiveRecord
|
d8c1a2e0
Yarik
Big commit artbox
|
54
|
{
|
cc658b4c
Yarik
Big commit
|
55
|
|
d8c1a2e0
Yarik
Big commit artbox
|
56
|
/**
|
cc658b4c
Yarik
Big commit
|
57
58
59
60
61
|
* @inheritdoc
*/
public function behaviors()
{
return [
|
93c267f7
Yarik
Multilanguage big...
|
62
63
64
65
66
67
68
69
70
|
[
'class' => SaveImgBehavior::className(),
'fields' => [
[
'name' => 'image',
'directory' => 'tax_option',
],
],
],
|
c70f24ea
Yarik
For Leha commit.
|
71
|
'language' => [
|
d55d2fe0
Yarik
Multilanguage
|
72
73
|
'class' => LanguageBehavior::className(),
],
|
cc658b4c
Yarik
Big commit
|
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
];
}
/**
* @inheritdoc
*/
public static function tableName()
{
return '{{%tax_option}}';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[
[
'tax_group_id',
|
cc658b4c
Yarik
Big commit
|
94
95
96
97
98
|
'sort',
],
'integer',
],
[
|
cc658b4c
Yarik
Big commit
|
99
100
101
102
|
[ 'tax_group_id' ],
'exist',
'skipOnError' => true,
'targetClass' => TaxGroup::className(),
|
c70f24ea
Yarik
For Leha commit.
|
103
|
'targetAttribute' => [ 'tax_group_id' => 'id' ],
|
cc658b4c
Yarik
Big commit
|
104
105
106
107
108
109
110
111
112
113
|
],
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
|
c70f24ea
Yarik
For Leha commit.
|
114
115
116
117
|
'id' => Yii::t('app', 'Tax Option ID'),
'tax_group_id' => Yii::t('app', 'Tax Group ID'),
'sort' => Yii::t('app', 'Sort'),
'image' => Yii::t('product', 'Image'),
|
cc658b4c
Yarik
Big commit
|
118
119
120
|
];
}
|
cc658b4c
Yarik
Big commit
|
121
122
123
|
/**
* @return \yii\db\ActiveQuery
*/
|
772a3ca4
Yarik
Big commit
|
124
|
public function getTaxGroup()
|
cc658b4c
Yarik
Big commit
|
125
|
{
|
772a3ca4
Yarik
Big commit
|
126
127
|
return $this->hasOne(TaxGroup::className(), [ 'id' => 'tax_group_id' ])
->inverseOf('taxOptions');
|
cc658b4c
Yarik
Big commit
|
128
129
130
|
}
/**
|
772a3ca4
Yarik
Big commit
|
131
132
133
|
* Synonim for TaxOption::getTaxGroup()
*
* @see TaxOption::getTaxGroup()
|
cc658b4c
Yarik
Big commit
|
134
135
|
* @return \yii\db\ActiveQuery
*/
|
772a3ca4
Yarik
Big commit
|
136
|
public function getGroup()
|
cc658b4c
Yarik
Big commit
|
137
|
{
|
772a3ca4
Yarik
Big commit
|
138
|
return $this->getTaxGroup();
|
cc658b4c
Yarik
Big commit
|
139
140
|
}
|
772a3ca4
Yarik
Big commit
|
141
142
143
|
/**
* @return ActiveQuery
*/
|
cc658b4c
Yarik
Big commit
|
144
145
|
public function getProducts()
{
|
8af13427
Yarik
For leha commit.
|
146
|
return $this->hasMany(Product::className(), [ 'id' => 'product_id' ])
|
c70f24ea
Yarik
For Leha commit.
|
147
|
->viaTable('product_option', [ 'option_id' => 'id' ]);
|
d8c1a2e0
Yarik
Big commit artbox
|
148
|
}
|
b7d40aed
Yarik
Another one admin...
|
149
|
|
772a3ca4
Yarik
Big commit
|
150
151
152
|
/**
* @return ActiveQuery
*/
|
b7d40aed
Yarik
Another one admin...
|
153
154
|
public function getProductVariants()
{
|
4428da8c
Yarik
Almost all databa...
|
155
|
return $this->hasMany(ProductVariant::className(), [ 'id' => 'product_variant_id' ])
|
c70f24ea
Yarik
For Leha commit.
|
156
|
->viaTable('product_variant_option', [ 'option_id' => 'id' ]);
|
b7d40aed
Yarik
Another one admin...
|
157
|
}
|
d8c1a2e0
Yarik
Big commit artbox
|
158
|
}
|