_task)) { $this->addError('_task', 'X is not array!'); } } public function byId() { if ($this->id) { return UserCard::find() ->where(['id' => $this->id]) ->with(['skillValues']) ->asArray() ->one(); } return null; } public function byParams() { $model = UserCard::find(); if($this->skills){ $model->joinWith(['skillValues']); $this->skills = explode(',', $this->skills); $model->where(['card_skill.skill_id' => $this->skills]); } else{ $model->with('skillValues'); } return $model->limit($this->limit) ->offset($this->offset)->asArray()->all(); } }