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
{{ message }}
This repository was archived by the owner on Feb 27, 2024. It is now read-only.
During feature test, when I'm trying to send multiple requests to show function (BaseApiController), all requests after first one fails in findById function (BaseApiRepository). I figured out that query builder instance is not destroyed after first request and where clauses remains from previous requests. For example:
// First request
"select * from "pages" where "pages"."id" = ? limit 1"
// Second request
"select * from "pages" where "pages"."id" = ? and "pages"."id" = ? limit 1"
// Third request
"select * from "pages" where "pages"."id" = ? and "pages"."id" = ? and "pages"."id" = ? limit 1"
One of possible solutions would be to update initQuery function in BaseApiRepository and unset Query Builder if it's set. E.g.
public function initQuery()
{
if (isset($this->query)) {
unset($this->query);
}
$this->query = $this->model->newQuery();
}