i have an online store with dynamic fields (specifications) and filters. All specifications are stored in table e.g
product_specifications:
-id
-product_id
-spec_id
-spec_val_id
Filters are connected with specifications, so when i send filter value i send specification values. For example
$_GET['Filters']['filter_id']['spec_val_id']
When i loop filters, i want to add left joins to product query. Something like that
$joinString = "";
foreach($filters){
$joinString .= "LEFT JOIN product_specifications AS prod_'.filter.' ON .....";
}
I have query to ActiveDataProvider like that:
$prodQuery = Product::find()->joinWith('translation')->joinWith('cats')->[HERE FILTERS JOINS]->where($whereString)->groupBy(['id']);
But if i have 5 filters, i need 5 joins to table product_specifications. Can i add in joinWith an array with all joins or add 5 joins to query chain? To one category my filters are also dynamically, so the page can have 5 or 10 filters, i can’t add static number of joinWith(‘specs’).
Thanks in advance.
I’m agree with different desicion, too.