There is a base Projects .
It has fields: id , name , partners , public .
The partners field is a string and contains data in the following form ["22","46","5","42","34","37","36"] , these data are recorded into the database through a multi-select in the admin panel.
I make filters on the frontend and there was a problem with selecting data by one of the values of the partners field, you need to make such a request:
$model = Project::find()->where(['public'=>1]) ->andWhere(['partners', '42']) ->orderBy('name DESC')->all(); In this form, the query naturally does not go through, it works through LIKE : ->andWhere(['LIKE', 'partners', '42'] , but if the values are unambiguous, the sample will be incorrect.
Tell me how to properly select a sample of one of the values of this field Perhaps the data of the partners field should be passed through json_decode , but how should this be linked to the database request?
json_decode, below described both of the resulting options - MasterAlex