Answer the question
In order to leave comments, you need to log in
Yii2 how to filter records on Many to Many relationship?
There are three tables: categories, products and linking them (because a product can have several categories).
There is a page that displays all-all products and a filter by category. In this case, several categories can be selected in the filter at once.
If there was only one category in the filter, then the selection of goods would be decided by a regular getter with hasMany viaTable. How to select products from several categories at once?
PS I would like to solve the problem using AR Yii2 wrappers, and not on pure sql, because the filter is large and there are many other parameters.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question