Fix issue where paginating on a query with a subquery in the where clause crashed
This commit is contained in:
parent
af3f5c5c5a
commit
09d28819b5
@ -88,6 +88,9 @@ class LimitSubqueryOutputWalker extends SqlWalker
|
||||
*/
|
||||
private $orderByPathExpressions = [];
|
||||
|
||||
/** @var bool $inSubselect */
|
||||
private $inSubselect = false;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
@ -434,18 +437,6 @@ class LimitSubqueryOutputWalker extends SqlWalker
|
||||
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
|
||||
*
|
||||
@ -541,4 +532,31 @@ class LimitSubqueryOutputWalker extends SqlWalker
|
||||
|
||||
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…
Reference in New Issue
Block a user