summaryrefslogtreecommitdiff
path: root/vendor/doctrine/orm/src/Tools/Pagination/RowNumberOverFunction.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/doctrine/orm/src/Tools/Pagination/RowNumberOverFunction.php')
-rw-r--r--vendor/doctrine/orm/src/Tools/Pagination/RowNumberOverFunction.php40
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
3declare(strict_types=1);
4
5namespace Doctrine\ORM\Tools\Pagination;
6
7use Doctrine\ORM\Query\AST\Functions\FunctionNode;
8use Doctrine\ORM\Query\AST\OrderByClause;
9use Doctrine\ORM\Query\Parser;
10use Doctrine\ORM\Query\SqlWalker;
11use Doctrine\ORM\Tools\Pagination\Exception\RowNumberOverFunctionNotEnabled;
12
13use function trim;
14
15/**
16 * RowNumberOverFunction
17 *
18 * Provides ROW_NUMBER() OVER(ORDER BY...) construct for use in LimitSubqueryOutputWalker
19 */
20class 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}