Skip to content

Commit c7e01ca

Browse files
mbabkerfranmomu
authored andcommitted
Restructure the SqlWalkerCompat trait to fix optimized autoloading
1 parent c1c2455 commit c7e01ca

File tree

4 files changed

+26
-6
lines changed

4 files changed

+26
-6
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ a release.
1818
---
1919

2020
## [Unreleased]
21+
### Fixed
22+
- Restructure the SqlWalkerCompat trait to fix optimized autoloading
2123

2224
## [3.16.0]
2325
### Added

src/Tool/ORM/Walker/SqlWalkerCompat.php

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,27 @@
1212
use Doctrine\ORM\Query\SqlWalker;
1313

1414
if ((new \ReflectionClass(SqlWalker::class))->getMethod('getExecutor')->hasReturnType()) {
15-
// ORM 3.x
16-
require_once __DIR__.'/orm-3.php';
15+
/**
16+
* Helper trait to address compatibility issues between ORM 2.x and 3.x.
17+
*
18+
* @mixin SqlWalker
19+
*
20+
* @internal
21+
*/
22+
trait SqlWalkerCompat
23+
{
24+
use SqlWalkerCompatForOrm3;
25+
}
1726
} else {
18-
// ORM 2.x
19-
require_once __DIR__.'/orm-2.php';
27+
/**
28+
* Helper trait to address compatibility issues between ORM 2.x and 3.x.
29+
*
30+
* @mixin SqlWalker
31+
*
32+
* @internal
33+
*/
34+
trait SqlWalkerCompat
35+
{
36+
use SqlWalkerCompatForOrm2;
37+
}
2038
}

src/Tool/ORM/Walker/orm-2.php renamed to src/Tool/ORM/Walker/SqlWalkerCompatForOrm2.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
*
3131
* @internal
3232
*/
33-
trait SqlWalkerCompat
33+
trait SqlWalkerCompatForOrm2
3434
{
3535
/**
3636
* Gets an executor that can be used to execute the result of this walker.

src/Tool/ORM/Walker/orm-3.php renamed to src/Tool/ORM/Walker/SqlWalkerCompatForOrm3.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
*
3333
* @internal
3434
*/
35-
trait SqlWalkerCompat
35+
trait SqlWalkerCompatForOrm3
3636
{
3737
/**
3838
* Gets an executor that can be used to execute the result of this walker.

0 commit comments

Comments
 (0)