Hello everyone, I have a query that I create through logical checks in line of my code 100 and I was wondering if there is any way to “edit” my query down the line by “changing” one of it’s parameters and then reuse it once again?
Example below:
// line 100 of my code
$example_query = $this->model->find();
if(condition_met){
$example_query->where(['field_spec' => VALUE_A]);
}
// I have my query object go through several logical checks.
//Eventually I execute my query
$data_A = $example_query->toArray();
// … Then many lines of code later I need to use the same query but with a parameter change:
$example_query->where(['field_spec' => VALUE_B]);
$data_B = $example_query->toArray();
If someone could recommend something I would appreciate it!