<?php

namespace common\modules\product\behaviors;


use common\modules\product\models\ProductOption;
use common\modules\rubrication\models\TaxOption;
use yii\base\Behavior;
use yii\db\ActiveRecord;

class FilterBehavior extends Behavior {

    public function getFilters(){
    
        /**
         * @var ActiveRecord $owner
         */
        $owner = $this->owner;
        
        return $owner->hasMany(TaxOption::className(), ['tax_option_id' => 'option_id'])
            ->viaTable(ProductOption::tableName(),[ 'product_id'=> $this->owner->tableSchema->primaryKey[0]])
            ->joinWith('taxGroup')->all();
    }


}