-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The query() method is called twice and the second call breaks the query builder sql #4140
Comments
Probably called twice because the first time it needs to count the rows. |
Ok although I am not sure about it. Its cursor not collection what query returns. But why the first sql is valid but second is broken? There is huge difference between them. |
No clue, it sounds like something isn't right with the query that package produces. We just call the query do a ->count() first and a ->chunk() next, so this package isn't doing anything weird. |
The clone() does not work in this case. |
Having the same problem, but my query is little bit different query() method runs twice, and on the second time it adds fixed by |
This is not fix. I would like to use Spatie QueryBuilder with its benefits around filtering. |
This bug report has been automatically closed because it has not had recent activity. If this is still an active bug, please comment to reopen. Thank you for your contributions. |
This is definitely a bug, but I managed to work around it by adding a check to see whether static $done = false;
if ($done) {
return $this->query;
}
$done = true;
//Now carry on making your modifications to `$query` |
Is the bug applicable and reproducable to the latest version of the package and hasn't it been reported before?
What version of Laravel Excel are you using?
3.1.55
What version of Laravel are you using?
9
What version of PHP are you using?
8.2
Describe your issue
I have a job which is in queue. This job generate xls exports from query. The query method is below. The application uses also Spatie Querybuilder library which works great. As I found out the query() method is called twice which is weird (job runs only once).
The first call generate valid SQL but the second call totaly ruin the sql from the builder.
The query() method looks like
Thi is the log from the run
The second sql is invalid cause it refers to table which is not defined in sql.
Can somebody tell me what is wrong with this code?
This is full error trace
How can the issue be reproduced?
As I described above
What should be the expected behaviour?
As I descripbe above.
The text was updated successfully, but these errors were encountered: