c3c1539f
Yarik
Tax Option fix
|
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
|
<?php
namespace common\behaviors;
use common\models\ProductSpec;
use common\modules\product\models\Product;
use yii\base\Behavior;
use yii\db\ActiveRecord;
/**
* Class TechBehavior
* @package common\behaviors
* @property Product $owner
*/
class TechBehavior extends Behavior
{
public function events()
{
return [
ActiveRecord::EVENT_AFTER_INSERT => 'afterInsert',
];
}
public function afterInsert($event) {
$owner = $this->owner;
$spec = new ProductSpec([
'product_id' => $owner->prodcut_id,
]);
$spec->generateLangs();
$spec->save(false);
}
}
|