Skip to content

Commit

Permalink
Restructure the SqlWalkerCompat trait to fix optimized autoloading
Browse files Browse the repository at this point in the history
  • Loading branch information
mbabker authored and franmomu committed Jun 25, 2024
1 parent c1c2455 commit c7e01ca
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ a release.
---

## [Unreleased]
### Fixed
- Restructure the SqlWalkerCompat trait to fix optimized autoloading

## [3.16.0]
### Added
Expand Down
26 changes: 22 additions & 4 deletions src/Tool/ORM/Walker/SqlWalkerCompat.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
*
* @internal
*/
trait SqlWalkerCompat
trait SqlWalkerCompatForOrm2
{
/**
* Gets an executor that can be used to execute the result of this walker.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
*
* @internal
*/
trait SqlWalkerCompat
trait SqlWalkerCompatForOrm3
{
/**
* Gets an executor that can be used to execute the result of this walker.
Expand Down

0 comments on commit c7e01ca

Please sign in to comment.