diff --git a/lib/Doctrine/ORM/Query/Exec/AbstractSqlExecutor.php b/lib/Doctrine/ORM/Query/Exec/AbstractSqlExecutor.php index 2374ad795e0..2ac9f7d59fe 100644 --- a/lib/Doctrine/ORM/Query/Exec/AbstractSqlExecutor.php +++ b/lib/Doctrine/ORM/Query/Exec/AbstractSqlExecutor.php @@ -89,6 +89,10 @@ public function __sleep(): array public function __wakeup(): void { + if ($this->_sqlStatements !== null && $this->sqlStatements === null) { + $this->sqlStatements = $this->_sqlStatements; + } + $this->_sqlStatements = &$this->sqlStatements; } } diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 809e541b90f..d1a6cd27406 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1844,6 +1844,14 @@ + + _sqlStatements]]> + _sqlStatements]]> + + + _sqlStatements !== null && $this->sqlStatements === null]]> + sqlStatements === null]]> + null @@ -1852,6 +1860,9 @@ $queryCacheProfile $sqlStatements + + _sqlStatements !== null]]> + sqlStatements]]> diff --git a/tests/Doctrine/Tests/ORM/Functional/ParserResultSerializationTest.php b/tests/Doctrine/Tests/ORM/Functional/ParserResultSerializationTest.php index 5d69c4c9209..55a9fc11b0b 100644 --- a/tests/Doctrine/Tests/ORM/Functional/ParserResultSerializationTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/ParserResultSerializationTest.php @@ -77,6 +77,7 @@ public function testUnserializeSingleSelectResult(string $serialized): void $this->assertInstanceOf(ResultSetMapping::class, $unserialized->getResultSetMapping()); $this->assertEquals(['name' => [0]], $unserialized->getParameterMappings()); $this->assertInstanceOf(SingleSelectExecutor::class, $unserialized->getSqlExecutor()); + $this->assertIsString($unserialized->getSqlExecutor()->getSqlStatements()); } /** @return Generator */