public function init() { parent::init(); $this->model = new $this->query->modelClass(); $this->baseQuery = clone $this->query; $this->subQuery = $this->model->getAttributesFilterRelation(); $this->subQuery->select('owner_id, COUNT(*) as filter_matched'); $this->subQuery->groupBy('owner_id'); $this->subQuery->primaryModel = null; }
/** * @param Connection|null $db * @return Category|array|null */ public function one($db = null) { return parent::one($db); }
/** * @inheritDoc */ public function behaviors() { return ArrayHelper::merge(parent::behaviors(), [Item::SortBehavior => ['class' => ActiveQueryBehavior::class]]); }