diff options
Diffstat (limited to 'vendor/doctrine/orm/src/Tools/Pagination/RowNumberOverFunction.php')
-rw-r--r-- | vendor/doctrine/orm/src/Tools/Pagination/RowNumberOverFunction.php | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/vendor/doctrine/orm/src/Tools/Pagination/RowNumberOverFunction.php b/vendor/doctrine/orm/src/Tools/Pagination/RowNumberOverFunction.php new file mode 100644 index 0000000..a0fdd01 --- /dev/null +++ b/vendor/doctrine/orm/src/Tools/Pagination/RowNumberOverFunction.php | |||
@@ -0,0 +1,40 @@ | |||
1 | <?php | ||
2 | |||
3 | declare(strict_types=1); | ||
4 | |||
5 | namespace Doctrine\ORM\Tools\Pagination; | ||
6 | |||
7 | use Doctrine\ORM\Query\AST\Functions\FunctionNode; | ||
8 | use Doctrine\ORM\Query\AST\OrderByClause; | ||
9 | use Doctrine\ORM\Query\Parser; | ||
10 | use Doctrine\ORM\Query\SqlWalker; | ||
11 | use Doctrine\ORM\Tools\Pagination\Exception\RowNumberOverFunctionNotEnabled; | ||
12 | |||
13 | use function trim; | ||
14 | |||
15 | /** | ||
16 | * RowNumberOverFunction | ||
17 | * | ||
18 | * Provides ROW_NUMBER() OVER(ORDER BY...) construct for use in LimitSubqueryOutputWalker | ||
19 | */ | ||
20 | class RowNumberOverFunction extends FunctionNode | ||
21 | { | ||
22 | public OrderByClause $orderByClause; | ||
23 | |||
24 | public function getSql(SqlWalker $sqlWalker): string | ||
25 | { | ||
26 | return 'ROW_NUMBER() OVER(' . trim($sqlWalker->walkOrderByClause( | ||
27 | $this->orderByClause, | ||
28 | )) . ')'; | ||
29 | } | ||
30 | |||
31 | /** | ||
32 | * @throws RowNumberOverFunctionNotEnabled | ||
33 | * | ||
34 | * @inheritdoc | ||
35 | */ | ||
36 | public function parse(Parser $parser): void | ||
37 | { | ||
38 | throw RowNumberOverFunctionNotEnabled::create(); | ||
39 | } | ||
40 | } | ||