Fix issue where paginating on a query with a subquery in the where clause crashed
This commit is contained in:
parent
af3f5c5c5a
commit
09d28819b5
1 changed files with 30 additions and 12 deletions
|
@ -88,6 +88,9 @@ class LimitSubqueryOutputWalker extends SqlWalker
|
||||||
*/
|
*/
|
||||||
private $orderByPathExpressions = [];
|
private $orderByPathExpressions = [];
|
||||||
|
|
||||||
|
/** @var bool $inSubselect */
|
||||||
|
private $inSubselect = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
|
@ -434,18 +437,6 @@ class LimitSubqueryOutputWalker extends SqlWalker
|
||||||
return $orderByItems;
|
return $orderByItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function walkPathExpression($pathExpr)
|
|
||||||
{
|
|
||||||
if (!$this->platformSupportsRowNumber() && !in_array($pathExpr, $this->orderByPathExpressions)) {
|
|
||||||
$this->orderByPathExpressions[] = $pathExpr;
|
|
||||||
}
|
|
||||||
|
|
||||||
return parent::walkPathExpression($pathExpr);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* getter for $orderByPathExpressions
|
* getter for $orderByPathExpressions
|
||||||
*
|
*
|
||||||
|
@ -541,4 +532,31 @@ class LimitSubqueryOutputWalker extends SqlWalker
|
||||||
|
|
||||||
return $sqlIdentifier;
|
return $sqlIdentifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function walkPathExpression($pathExpr)
|
||||||
|
{
|
||||||
|
if (!$this->inSubselect && !$this->platformSupportsRowNumber() && !in_array($pathExpr, $this->orderByPathExpressions)) {
|
||||||
|
$this->orderByPathExpressions[] = $pathExpr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::walkPathExpression($pathExpr);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function walkSubSelect($subselect)
|
||||||
|
{
|
||||||
|
// We don't want to add path expressions from subselects into the select clause of the containing query.
|
||||||
|
$this->inSubselect = true;
|
||||||
|
|
||||||
|
$sql = parent::walkSubselect($subselect);
|
||||||
|
|
||||||
|
$this->inSubselect = false;
|
||||||
|
|
||||||
|
return $sql;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue