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
In the paginateUsingCursor method of the BuildsQueries trait , there is a condition that never seems to be resolved.
To be specific, in the recursive function $addCursorConditions when ! is_null($previousColumn), the code should add the where condition to each $unionBuilders.
As the function is recursive, the only way to resolve the ! is_null($previousColumn) condition is by invoking the function in the next lines, where it is called within 2 closure functions of the where method. The builder passed to the $addCursorConditions function at this point, turns out to be that of the closure which, being a newQuery(), does not have the unions of the original query builder.
Wheres conditions for pagination are then added only for the unions of the main query and not recursively to all unions.
I find myself in the position of not being able to understand the original idea of whoever developed this functionality.
If the idea is to add the where conditions to all unions recursively, the code probably needs to be fixed.
If, on the other hand, where conditions needs to be added only to the unions of the main query, there is probably an obsolete piece of code to be removed.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
In the
paginateUsingCursor
method of theBuildsQueries
trait , there is a condition that never seems to be resolved.To be specific, in the recursive function
$addCursorConditions
when! is_null($previousColumn)
, the code should add the where condition to each$unionBuilders
.As the function is recursive, the only way to resolve the
! is_null($previousColumn)
condition is by invoking the function in the next lines, where it is called within 2 closure functions of the where method. The builder passed to the$addCursorConditions
function at this point, turns out to be that of the closure which, being a newQuery(), does not have the unions of the original query builder.Wheres conditions for pagination are then added only for the unions of the main query and not recursively to all unions.
I find myself in the position of not being able to understand the original idea of whoever developed this functionality.
If the idea is to add the where conditions to all unions recursively, the code probably needs to be fixed.
If, on the other hand, where conditions needs to be added only to the unions of the main query, there is probably an obsolete piece of code to be removed.
Beta Was this translation helpful? Give feedback.
All reactions