I'm first applying the other filters. Then clone the QueryBuilder to get the counts and final result set.
It seems that cloning the query builder doesn't work properly.
The internal reference to the underlying Builder is retained and hence the clone() call is a noop.
When dumping the SQL statement of $query between the counts and the final pagination call it seems that those count scopes are both incorporated, even though the $query variable was cloned.
I'm building an index overview with some filter fields and also a discriminating results filter (by means of tabs):
The mentioned count badges should take into account the actual filtered result set, but of course without one filter applied.
So I have this code:
I'm first applying the other filters. Then clone the QueryBuilder to get the counts and final result set.
It seems that cloning the query builder doesn't work properly. The internal reference to the underlying Builder is retained and hence the
clone()
call is a noop.When dumping the SQL statement of
$query
between the counts and the final pagination call it seems that those count scopes are both incorporated, even though the$query
variable was cloned.