diff --git a/CHANGELOG.md b/CHANGELOG.md index f924644f5e..f6b0930b0d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,8 @@ a release. --- ## [Unreleased] +### Fixed +- Restructure the SqlWalkerCompat trait to fix optimized autoloading ## [3.16.0] ### Added diff --git a/src/Tool/ORM/Walker/SqlWalkerCompat.php b/src/Tool/ORM/Walker/SqlWalkerCompat.php index 5dceefc019..24721d729a 100644 --- a/src/Tool/ORM/Walker/SqlWalkerCompat.php +++ b/src/Tool/ORM/Walker/SqlWalkerCompat.php @@ -12,9 +12,27 @@ use Doctrine\ORM\Query\SqlWalker; if ((new \ReflectionClass(SqlWalker::class))->getMethod('getExecutor')->hasReturnType()) { - // ORM 3.x - require_once __DIR__.'/orm-3.php'; + /** + * Helper trait to address compatibility issues between ORM 2.x and 3.x. + * + * @mixin SqlWalker + * + * @internal + */ + trait SqlWalkerCompat + { + use SqlWalkerCompatForOrm3; + } } else { - // ORM 2.x - require_once __DIR__.'/orm-2.php'; + /** + * Helper trait to address compatibility issues between ORM 2.x and 3.x. + * + * @mixin SqlWalker + * + * @internal + */ + trait SqlWalkerCompat + { + use SqlWalkerCompatForOrm2; + } } diff --git a/src/Tool/ORM/Walker/orm-2.php b/src/Tool/ORM/Walker/SqlWalkerCompatForOrm2.php similarity index 99% rename from src/Tool/ORM/Walker/orm-2.php rename to src/Tool/ORM/Walker/SqlWalkerCompatForOrm2.php index d8fd670790..e810c749be 100644 --- a/src/Tool/ORM/Walker/orm-2.php +++ b/src/Tool/ORM/Walker/SqlWalkerCompatForOrm2.php @@ -30,7 +30,7 @@ * * @internal */ -trait SqlWalkerCompat +trait SqlWalkerCompatForOrm2 { /** * Gets an executor that can be used to execute the result of this walker. diff --git a/src/Tool/ORM/Walker/orm-3.php b/src/Tool/ORM/Walker/SqlWalkerCompatForOrm3.php similarity index 99% rename from src/Tool/ORM/Walker/orm-3.php rename to src/Tool/ORM/Walker/SqlWalkerCompatForOrm3.php index 380d64ff5a..bb7b8289a9 100644 --- a/src/Tool/ORM/Walker/orm-3.php +++ b/src/Tool/ORM/Walker/SqlWalkerCompatForOrm3.php @@ -32,7 +32,7 @@ * * @internal */ -trait SqlWalkerCompat +trait SqlWalkerCompatForOrm3 { /** * Gets an executor that can be used to execute the result of this walker.