Skip to content

Commit

Permalink
Set parent conditionally
Browse files Browse the repository at this point in the history
Signed-off-by: pine3ree <pine3ree@gmail.com>
  • Loading branch information
pine3ree committed Oct 14, 2023
1 parent 9d935fa commit f87b6b0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Sql/Statement/Select.php
Original file line number Diff line number Diff line change
Expand Up @@ -1059,9 +1059,12 @@ public function getSQL(DriverInterface $driver = null, Params $params = null, bo
if ($driver instanceof SelectSqlDecorator) {
$this->sql = $driver->decorateSelectSQL($this, $params, $pretty);
} elseif ($driver instanceof SelectDecorator) {
$parent = $this->parent; // this parent may be changed by the decorator
// The original parent may be changed by the decorator returning a different instance
$parent = $this->parent;
$select = $driver->decorateSelect($this, $params);
$select->setParent($parent);
if (isset($parent)) {
$select->setParent($parent);
}
$this->sql = $select->generateSQL($driver, $params, $pretty);
} else {
// Generate and cache a fresh sql string
Expand Down

0 comments on commit f87b6b0

Please sign in to comment.