I have a situation where I need to add multiple query-builder objects into one query.
But what happens now is that the params in the Query are shared. I have code like that:
$query = new Query;
foreach ($my->usedFilters as $qhf) {
$rules = Json::decode($qhf->questionFilter->filter);
$translator = new Translator($rules);
$query
->andWhere($translator->where())
->addParams($translator->params());
}
What happens here is that the params in Query is for the whole query. With each loop the params will be reassigned as p0, p1 .. pn and with each loop they get overwritten.
So I am thinking that the Translator could have something like setCurrentParams($params) where you could set the already assigned params and the next ones would be added on top rather than overwritten.
so we would have code like that for my implementation
$query = new Query;
foreach ($my->usedFilters as $qhf) {
$rules = Json::decode($qhf->questionFilter->filter);
$translator = new Translator($rules);
$translator->setCurrentParams($query->params);
$query
->andWhere($translator->where())
->addParams($translator->params());
}
Hi,
I'd like to propose an additional feature.
I have a situation where I need to add multiple query-builder objects into one query. But what happens now is that the params in the Query are shared. I have code like that:
What happens here is that the params in Query is for the whole query. With each loop the params will be reassigned as p0, p1 .. pn and with each loop they get overwritten.
So I am thinking that the Translator could have something like setCurrentParams($params) where you could set the already assigned params and the next ones would be added on top rather than overwritten.
so we would have code like that for my implementation