bosnadev / repository

Laravel Repositories is a package for Laravel 5 which is used to abstract the database layer. This makes applications much easier to maintain.
https://bosnadev.com
825 stars 235 forks source link

Criteria stay applied for the next query #45

Closed Gael42 closed 9 years ago

Gael42 commented 9 years ago

I need to retrieve two collections from the same repository, but when pushgin criterias they stay applied to the repository for the next query :

$elements = $this->elementRepository->pushCriteria(new ElementByElementTypeCriteria(1)->paginate(7);
// the Criteria stay applied for the next call to paginate() on the same repo
$elements_type = $this->elementRepository->pushCriteria(new ElementByElementTypeCriteria(6))->paginate(3);

What is the good approach to do that ?

Gael42 commented 9 years ago

I was just misunderstanding of the way to use your package :-)