repository icon indicating copy to clipboard operation
repository copied to clipboard

Usage question

Open sroutier opened this issue 9 years ago • 0 comments

Hey there,

Thanks for your awesome library, I have a question, hopefully not a bug, I am probably not using it right....

Using your example in the README, in the FilmsController, after you perform a search such as:

$filmsToDelete = $this->film->pushCriteria(new FilmCreatedBefore($search_date))->all();

The element $this->film->model changes from a instance of Film model to an instance of Illuminate\Database\Eloquent\Builder, this in turns makes it impossible to call the RepositoryInterface functions such as in:

        foreach( $filmsToDelete as $f) {
            $this->film->delete($f->id);
        }

This fails with Call to undefined method Illuminate\Database\Query\Builder::destroy() as the Repository.php calls $this->model->destroy($id); on line 126, but since the model is not a model anymore it fails.

Is this the expected behaviour or am I doing something wrong?

Thanks. /S

sroutier avatar Oct 30 '15 19:10 sroutier