Open carlituxman opened 8 years ago
the problem is because I have a loop after the criteria, only do it well in the first iteration
I'm researching what's happen...
the problem is because (I think) the criteria apply in every loop again
The problem is because in every iteration the query is stacked I solve using: $this->repo->skipCriteria(); $this->repo->pushCriteria(new myCriteria());
in every iteration
this should be cleared in every find, findWhere, ... ??
I'm doing a criteria before a query like:
$all = $this->repo->findWhere(['status_id'=> $status->id, 'user_id'=> 1])->count();
my criteria is like this:
public function apply($model, Repository $repository) { $users = User::filtered()->lists('id')->toArray(); $model = $model->where('user_id', $users); return $model; }
the result of criteria is correct, but when I do the findWhere after it returns 0 (and should be return more)