-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for new SqlOutputWalker class in the ORM
- Loading branch information
Showing
6 changed files
with
194 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Doctrine Behavioral Extensions package. | ||
* (c) Gediminas Morkevicius <[email protected]> http://www.gediminasm.org | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Gedmo\Tool\ORM\Walker; | ||
|
||
use Doctrine\ORM\Query\SqlOutputWalker; | ||
use Doctrine\ORM\Query\SqlWalker; | ||
|
||
if (class_exists(SqlOutputWalker::class)) { | ||
if ((new \ReflectionClass(SqlWalker::class))->getMethod('getExecutor')->hasReturnType()) { | ||
/** | ||
* Helper trait to address compatibility issues between ORM 2.x and 3.x. | ||
* | ||
* @internal | ||
*/ | ||
abstract class CompatSqlOutputWalker extends SqlOutputWalker | ||
{ | ||
use CompatSqlOutputWalkerForOrm3; | ||
} | ||
} else { | ||
/** | ||
* Helper trait to address compatibility issues between ORM 2.x and 3.x. | ||
* | ||
* @internal | ||
*/ | ||
abstract class CompatSqlOutputWalker extends SqlOutputWalker | ||
{ | ||
use CompatSqlOutputWalkerForOrm2; | ||
} | ||
} | ||
} else { | ||
if ((new \ReflectionClass(SqlWalker::class))->getMethod('getExecutor')->hasReturnType()) { | ||
/** | ||
* Helper trait to address compatibility issues between ORM 2.x and 3.x. | ||
* | ||
* @internal | ||
*/ | ||
abstract class CompatSqlOutputWalker extends SqlWalker | ||
{ | ||
use CompatSqlOutputWalkerForOrm3; | ||
} | ||
} else { | ||
/** | ||
* Helper trait to address compatibility issues between ORM 2.x and 3.x. | ||
* | ||
* @internal | ||
*/ | ||
abstract class CompatSqlOutputWalker extends SqlWalker | ||
{ | ||
use CompatSqlOutputWalkerForOrm2; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Doctrine Behavioral Extensions package. | ||
* (c) Gediminas Morkevicius <[email protected]> http://www.gediminasm.org | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Gedmo\Tool\ORM\Walker; | ||
|
||
use Doctrine\ORM\Query\AST\DeleteStatement; | ||
use Doctrine\ORM\Query\AST\SelectStatement; | ||
use Doctrine\ORM\Query\AST\UpdateStatement; | ||
use Doctrine\ORM\Query\Exec\SqlFinalizer; | ||
use Doctrine\ORM\Query\SqlOutputWalker; | ||
|
||
/** | ||
* Helper trait to address compatibility issues between ORM 2.x and 3.x. | ||
* | ||
* @mixin SqlOutputWalker | ||
* | ||
* @internal | ||
*/ | ||
trait CompatSqlOutputWalkerForOrm2 | ||
{ | ||
/** | ||
* @param DeleteStatement|UpdateStatement|SelectStatement $AST | ||
*/ | ||
public function getFinalizer($AST): SqlFinalizer | ||
{ | ||
return $this->doGetFinalizerWithCompat($AST); | ||
} | ||
|
||
/** | ||
* @param DeleteStatement|UpdateStatement|SelectStatement $AST | ||
*/ | ||
protected function doGetFinalizerWithCompat($AST): SqlFinalizer | ||
{ | ||
return parent::getFinalizer($AST); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Doctrine Behavioral Extensions package. | ||
* (c) Gediminas Morkevicius <[email protected]> http://www.gediminasm.org | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Gedmo\Tool\ORM\Walker; | ||
|
||
use Doctrine\ORM\Query\AST\DeleteStatement; | ||
use Doctrine\ORM\Query\AST\SelectStatement; | ||
use Doctrine\ORM\Query\AST\UpdateStatement; | ||
use Doctrine\ORM\Query\Exec\SqlFinalizer; | ||
use Doctrine\ORM\Query\SqlOutputWalker; | ||
|
||
/** | ||
* Helper trait to address compatibility issues between ORM 2.x and 3.x. | ||
* | ||
* @mixin SqlOutputWalker | ||
* | ||
* @internal | ||
*/ | ||
trait CompatSqlOutputWalkerForOrm3 | ||
{ | ||
public function getFinalizer(DeleteStatement|UpdateStatement|SelectStatement $AST): SqlFinalizer | ||
{ | ||
return $this->doGetFinalizerWithCompat($AST); | ||
} | ||
|
||
/** | ||
* @param DeleteStatement|UpdateStatement|SelectStatement $AST | ||
*/ | ||
protected function doGetFinalizerWithCompat($AST): SqlFinalizer | ||
{ | ||
return parent::getFinalizer($AST); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters