api search profile fix

This commit is contained in:
andrey 2021-06-25 18:19:02 +03:00
parent 96a8a530ed
commit 8c9b5f04d4

View File

@ -5,6 +5,7 @@ namespace frontend\modules\api\models;
use backend\modules\card\models\UserCard; use backend\modules\card\models\UserCard;
use common\classes\Debug;
use yii\base\Model; use yii\base\Model;
/** /**
@ -52,13 +53,18 @@ class ProfileSearchForm extends Model
public function byParams() public function byParams()
{ {
$model = UserCard::find() $model = UserCard::find();
->joinWith(['skillValues']);
if($this->skills){ if($this->skills){
$model->joinWith(['skillValues']);
Debug::prn(123);
$this->skills = explode(',', $this->skills); $this->skills = explode(',', $this->skills);
$model->where(['card_skill.skill_id' => $this->skills]); $model->where(['card_skill.skill_id' => $this->skills]);
} }
else{
$model->with('skillValues');
}
return $model->limit($this->limit) return $model->limit($this->limit)
->offset($this->offset)->asArray()->all(); ->offset($this->offset)->asArray()->all();