You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If we turn on presenter & transformer for a repository and call limit() on the instance it returns an error because the limit() method in BaseRepository calls parserResult() and if you have presenter on then it will call the transform method which expects an instance of the model but instead it is getting the model which is a query builder.
If I change the code for limit to the following (so it is similar to orderBy()):
public function limit($limit)
{
$this->model = $this->model->limit($limit);
return $this;
}
It all works as it should with the presenter.
public function limit($limit)
{
$this->applyCriteria();
$this->applyScope();
$results = $this->model->limit($limit);
$this->resetModel();
return $this->parserResult($results);
}
The above code which is currently in Eloquent\BaseRepository expects model->limit($limit) to return results but limit in eloquent model doesn't work that way.
I would make a pull request but I am not sure how to do it on github.
The text was updated successfully, but these errors were encountered:
If we turn on presenter & transformer for a repository and call
limit()
on the instance it returns an error because thelimit()
method inBaseRepository
callsparserResult()
and if you have presenter on then it will call the transform method which expects an instance of the model but instead it is getting the model which is a query builder.If I change the code for limit to the following (so it is similar to orderBy()):
It all works as it should with the presenter.
The above code which is currently in
Eloquent\BaseRepository
expectsmodel->limit($limit)
to return results but limit in eloquent model doesn't work that way.I would make a pull request but I am not sure how to do it on github.
The text was updated successfully, but these errors were encountered: