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; }