diff options
| author | polo <ordipolo@gmx.fr> | 2024-08-13 23:45:21 +0200 |
|---|---|---|
| committer | polo <ordipolo@gmx.fr> | 2024-08-13 23:45:21 +0200 |
| commit | bf6655a534a6775d30cafa67bd801276bda1d98d (patch) | |
| tree | c6381e3f6c81c33eab72508f410b165ba05f7e9c /vendor/doctrine/orm/src/Query/Expr | |
| parent | 94d67a4b51f8e62e7d518cce26a526ae1ec48278 (diff) | |
| download | AppliGestionPHP-bf6655a534a6775d30cafa67bd801276bda1d98d.tar.gz AppliGestionPHP-bf6655a534a6775d30cafa67bd801276bda1d98d.tar.bz2 AppliGestionPHP-bf6655a534a6775d30cafa67bd801276bda1d98d.zip | |
VERSION 0.2 doctrine ORM et entités
Diffstat (limited to 'vendor/doctrine/orm/src/Query/Expr')
| -rw-r--r-- | vendor/doctrine/orm/src/Query/Expr/Andx.php | 32 | ||||
| -rw-r--r-- | vendor/doctrine/orm/src/Query/Expr/Base.php | 96 | ||||
| -rw-r--r-- | vendor/doctrine/orm/src/Query/Expr/Comparison.php | 47 | ||||
| -rw-r--r-- | vendor/doctrine/orm/src/Query/Expr/Composite.php | 50 | ||||
| -rw-r--r-- | vendor/doctrine/orm/src/Query/Expr/From.php | 48 | ||||
| -rw-r--r-- | vendor/doctrine/orm/src/Query/Expr/Func.php | 48 | ||||
| -rw-r--r-- | vendor/doctrine/orm/src/Query/Expr/GroupBy.php | 25 | ||||
| -rw-r--r-- | vendor/doctrine/orm/src/Query/Expr/Join.php | 77 | ||||
| -rw-r--r-- | vendor/doctrine/orm/src/Query/Expr/Literal.php | 25 | ||||
| -rw-r--r-- | vendor/doctrine/orm/src/Query/Expr/Math.php | 59 | ||||
| -rw-r--r-- | vendor/doctrine/orm/src/Query/Expr/OrderBy.php | 60 | ||||
| -rw-r--r-- | vendor/doctrine/orm/src/Query/Expr/Orx.php | 32 | ||||
| -rw-r--r-- | vendor/doctrine/orm/src/Query/Expr/Select.php | 28 |
13 files changed, 627 insertions, 0 deletions
diff --git a/vendor/doctrine/orm/src/Query/Expr/Andx.php b/vendor/doctrine/orm/src/Query/Expr/Andx.php new file mode 100644 index 0000000..a20bcef --- /dev/null +++ b/vendor/doctrine/orm/src/Query/Expr/Andx.php | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | <?php | ||
| 2 | |||
| 3 | declare(strict_types=1); | ||
| 4 | |||
| 5 | namespace Doctrine\ORM\Query\Expr; | ||
| 6 | |||
| 7 | /** | ||
| 8 | * Expression class for building DQL and parts. | ||
| 9 | * | ||
| 10 | * @link www.doctrine-project.org | ||
| 11 | */ | ||
| 12 | class Andx extends Composite | ||
| 13 | { | ||
| 14 | protected string $separator = ' AND '; | ||
| 15 | |||
| 16 | /** @var string[] */ | ||
| 17 | protected array $allowedClasses = [ | ||
| 18 | Comparison::class, | ||
| 19 | Func::class, | ||
| 20 | Orx::class, | ||
| 21 | self::class, | ||
| 22 | ]; | ||
| 23 | |||
| 24 | /** @psalm-var list<string|Comparison|Func|Orx|self> */ | ||
| 25 | protected array $parts = []; | ||
| 26 | |||
| 27 | /** @psalm-return list<string|Comparison|Func|Orx|self> */ | ||
| 28 | public function getParts(): array | ||
| 29 | { | ||
| 30 | return $this->parts; | ||
| 31 | } | ||
| 32 | } | ||
diff --git a/vendor/doctrine/orm/src/Query/Expr/Base.php b/vendor/doctrine/orm/src/Query/Expr/Base.php new file mode 100644 index 0000000..e0f2572 --- /dev/null +++ b/vendor/doctrine/orm/src/Query/Expr/Base.php | |||
| @@ -0,0 +1,96 @@ | |||
| 1 | <?php | ||
| 2 | |||
| 3 | declare(strict_types=1); | ||
| 4 | |||
| 5 | namespace Doctrine\ORM\Query\Expr; | ||
| 6 | |||
| 7 | use InvalidArgumentException; | ||
| 8 | use Stringable; | ||
| 9 | |||
| 10 | use function array_key_exists; | ||
| 11 | use function count; | ||
| 12 | use function get_debug_type; | ||
| 13 | use function implode; | ||
| 14 | use function in_array; | ||
| 15 | use function is_array; | ||
| 16 | use function is_string; | ||
| 17 | use function sprintf; | ||
| 18 | |||
| 19 | /** | ||
| 20 | * Abstract base Expr class for building DQL parts. | ||
| 21 | * | ||
| 22 | * @link www.doctrine-project.org | ||
| 23 | */ | ||
| 24 | abstract class Base implements Stringable | ||
| 25 | { | ||
| 26 | protected string $preSeparator = '('; | ||
| 27 | protected string $separator = ', '; | ||
| 28 | protected string $postSeparator = ')'; | ||
| 29 | |||
| 30 | /** @var list<class-string> */ | ||
| 31 | protected array $allowedClasses = []; | ||
| 32 | |||
| 33 | /** @var list<string|Stringable> */ | ||
| 34 | protected array $parts = []; | ||
| 35 | |||
| 36 | public function __construct(mixed $args = []) | ||
| 37 | { | ||
| 38 | if (is_array($args) && array_key_exists(0, $args) && is_array($args[0])) { | ||
| 39 | $args = $args[0]; | ||
| 40 | } | ||
| 41 | |||
| 42 | $this->addMultiple($args); | ||
| 43 | } | ||
| 44 | |||
| 45 | /** | ||
| 46 | * @param string[]|object[]|string|object $args | ||
| 47 | * @psalm-param list<string|object>|string|object $args | ||
| 48 | * | ||
| 49 | * @return $this | ||
| 50 | */ | ||
| 51 | public function addMultiple(array|string|object $args = []): static | ||
| 52 | { | ||
| 53 | foreach ((array) $args as $arg) { | ||
| 54 | $this->add($arg); | ||
| 55 | } | ||
| 56 | |||
| 57 | return $this; | ||
| 58 | } | ||
| 59 | |||
| 60 | /** | ||
| 61 | * @return $this | ||
| 62 | * | ||
| 63 | * @throws InvalidArgumentException | ||
| 64 | */ | ||
| 65 | public function add(mixed $arg): static | ||
| 66 | { | ||
| 67 | if ($arg !== null && (! $arg instanceof self || $arg->count() > 0)) { | ||
| 68 | // If we decide to keep Expr\Base instances, we can use this check | ||
| 69 | if (! is_string($arg) && ! in_array($arg::class, $this->allowedClasses, true)) { | ||
| 70 | throw new InvalidArgumentException(sprintf( | ||
| 71 | "Expression of type '%s' not allowed in this context.", | ||
| 72 | get_debug_type($arg), | ||
| 73 | )); | ||
| 74 | } | ||
| 75 | |||
| 76 | $this->parts[] = $arg; | ||
| 77 | } | ||
| 78 | |||
| 79 | return $this; | ||
| 80 | } | ||
| 81 | |||
| 82 | /** @psalm-return 0|positive-int */ | ||
| 83 | public function count(): int | ||
| 84 | { | ||
| 85 | return count($this->parts); | ||
| 86 | } | ||
| 87 | |||
| 88 | public function __toString(): string | ||
| 89 | { | ||
| 90 | if ($this->count() === 1) { | ||
| 91 | return (string) $this->parts[0]; | ||
| 92 | } | ||
| 93 | |||
| 94 | return $this->preSeparator . implode($this->separator, $this->parts) . $this->postSeparator; | ||
| 95 | } | ||
| 96 | } | ||
diff --git a/vendor/doctrine/orm/src/Query/Expr/Comparison.php b/vendor/doctrine/orm/src/Query/Expr/Comparison.php new file mode 100644 index 0000000..ec8ef21 --- /dev/null +++ b/vendor/doctrine/orm/src/Query/Expr/Comparison.php | |||
| @@ -0,0 +1,47 @@ | |||
| 1 | <?php | ||
| 2 | |||
| 3 | declare(strict_types=1); | ||
| 4 | |||
| 5 | namespace Doctrine\ORM\Query\Expr; | ||
| 6 | |||
| 7 | use Stringable; | ||
| 8 | |||
| 9 | /** | ||
| 10 | * Expression class for DQL comparison expressions. | ||
| 11 | * | ||
| 12 | * @link www.doctrine-project.org | ||
| 13 | */ | ||
| 14 | class Comparison implements Stringable | ||
| 15 | { | ||
| 16 | final public const EQ = '='; | ||
| 17 | final public const NEQ = '<>'; | ||
| 18 | final public const LT = '<'; | ||
| 19 | final public const LTE = '<='; | ||
| 20 | final public const GT = '>'; | ||
| 21 | final public const GTE = '>='; | ||
| 22 | |||
| 23 | /** Creates a comparison expression with the given arguments. */ | ||
| 24 | public function __construct(protected mixed $leftExpr, protected string $operator, protected mixed $rightExpr) | ||
| 25 | { | ||
| 26 | } | ||
| 27 | |||
| 28 | public function getLeftExpr(): mixed | ||
| 29 | { | ||
| 30 | return $this->leftExpr; | ||
| 31 | } | ||
| 32 | |||
| 33 | public function getOperator(): string | ||
| 34 | { | ||
| 35 | return $this->operator; | ||
| 36 | } | ||
| 37 | |||
| 38 | public function getRightExpr(): mixed | ||
| 39 | { | ||
| 40 | return $this->rightExpr; | ||
| 41 | } | ||
| 42 | |||
| 43 | public function __toString(): string | ||
| 44 | { | ||
| 45 | return $this->leftExpr . ' ' . $this->operator . ' ' . $this->rightExpr; | ||
| 46 | } | ||
| 47 | } | ||
diff --git a/vendor/doctrine/orm/src/Query/Expr/Composite.php b/vendor/doctrine/orm/src/Query/Expr/Composite.php new file mode 100644 index 0000000..f3007a7 --- /dev/null +++ b/vendor/doctrine/orm/src/Query/Expr/Composite.php | |||
| @@ -0,0 +1,50 @@ | |||
| 1 | <?php | ||
| 2 | |||
| 3 | declare(strict_types=1); | ||
| 4 | |||
| 5 | namespace Doctrine\ORM\Query\Expr; | ||
| 6 | |||
| 7 | use Stringable; | ||
| 8 | |||
| 9 | use function implode; | ||
| 10 | use function is_object; | ||
| 11 | use function preg_match; | ||
| 12 | |||
| 13 | /** | ||
| 14 | * Expression class for building DQL and parts. | ||
| 15 | * | ||
| 16 | * @link www.doctrine-project.org | ||
| 17 | */ | ||
| 18 | class Composite extends Base | ||
| 19 | { | ||
| 20 | public function __toString(): string | ||
| 21 | { | ||
| 22 | if ($this->count() === 1) { | ||
| 23 | return (string) $this->parts[0]; | ||
| 24 | } | ||
| 25 | |||
| 26 | $components = []; | ||
| 27 | |||
| 28 | foreach ($this->parts as $part) { | ||
| 29 | $components[] = $this->processQueryPart($part); | ||
| 30 | } | ||
| 31 | |||
| 32 | return implode($this->separator, $components); | ||
| 33 | } | ||
| 34 | |||
| 35 | private function processQueryPart(string|Stringable $part): string | ||
| 36 | { | ||
| 37 | $queryPart = (string) $part; | ||
| 38 | |||
| 39 | if (is_object($part) && $part instanceof self && $part->count() > 1) { | ||
| 40 | return $this->preSeparator . $queryPart . $this->postSeparator; | ||
| 41 | } | ||
| 42 | |||
| 43 | // Fixes DDC-1237: User may have added a where item containing nested expression (with "OR" or "AND") | ||
| 44 | if (preg_match('/\s(OR|AND)\s/i', $queryPart)) { | ||
| 45 | return $this->preSeparator . $queryPart . $this->postSeparator; | ||
| 46 | } | ||
| 47 | |||
| 48 | return $queryPart; | ||
| 49 | } | ||
| 50 | } | ||
diff --git a/vendor/doctrine/orm/src/Query/Expr/From.php b/vendor/doctrine/orm/src/Query/Expr/From.php new file mode 100644 index 0000000..21af078 --- /dev/null +++ b/vendor/doctrine/orm/src/Query/Expr/From.php | |||
| @@ -0,0 +1,48 @@ | |||
| 1 | <?php | ||
| 2 | |||
| 3 | declare(strict_types=1); | ||
| 4 | |||
| 5 | namespace Doctrine\ORM\Query\Expr; | ||
| 6 | |||
| 7 | use Stringable; | ||
| 8 | |||
| 9 | /** | ||
| 10 | * Expression class for DQL from. | ||
| 11 | * | ||
| 12 | * @link www.doctrine-project.org | ||
| 13 | */ | ||
| 14 | class From implements Stringable | ||
| 15 | { | ||
| 16 | /** | ||
| 17 | * @param class-string $from The class name. | ||
| 18 | * @param string $alias The alias of the class. | ||
| 19 | */ | ||
| 20 | public function __construct( | ||
| 21 | protected string $from, | ||
| 22 | protected string $alias, | ||
| 23 | protected string|null $indexBy = null, | ||
| 24 | ) { | ||
| 25 | } | ||
| 26 | |||
| 27 | /** @return class-string */ | ||
| 28 | public function getFrom(): string | ||
| 29 | { | ||
| 30 | return $this->from; | ||
| 31 | } | ||
| 32 | |||
| 33 | public function getAlias(): string | ||
| 34 | { | ||
| 35 | return $this->alias; | ||
| 36 | } | ||
| 37 | |||
| 38 | public function getIndexBy(): string|null | ||
| 39 | { | ||
| 40 | return $this->indexBy; | ||
| 41 | } | ||
| 42 | |||
| 43 | public function __toString(): string | ||
| 44 | { | ||
| 45 | return $this->from . ' ' . $this->alias . | ||
| 46 | ($this->indexBy ? ' INDEX BY ' . $this->indexBy : ''); | ||
| 47 | } | ||
| 48 | } | ||
diff --git a/vendor/doctrine/orm/src/Query/Expr/Func.php b/vendor/doctrine/orm/src/Query/Expr/Func.php new file mode 100644 index 0000000..cd9e8e0 --- /dev/null +++ b/vendor/doctrine/orm/src/Query/Expr/Func.php | |||
| @@ -0,0 +1,48 @@ | |||
| 1 | <?php | ||
| 2 | |||
| 3 | declare(strict_types=1); | ||
| 4 | |||
| 5 | namespace Doctrine\ORM\Query\Expr; | ||
| 6 | |||
| 7 | use Stringable; | ||
| 8 | |||
| 9 | use function implode; | ||
| 10 | |||
| 11 | /** | ||
| 12 | * Expression class for generating DQL functions. | ||
| 13 | * | ||
| 14 | * @link www.doctrine-project.org | ||
| 15 | */ | ||
| 16 | class Func implements Stringable | ||
| 17 | { | ||
| 18 | /** @var mixed[] */ | ||
| 19 | protected array $arguments; | ||
| 20 | |||
| 21 | /** | ||
| 22 | * Creates a function, with the given argument. | ||
| 23 | * | ||
| 24 | * @psalm-param list<mixed>|mixed $arguments | ||
| 25 | */ | ||
| 26 | public function __construct( | ||
| 27 | protected string $name, | ||
| 28 | mixed $arguments, | ||
| 29 | ) { | ||
| 30 | $this->arguments = (array) $arguments; | ||
| 31 | } | ||
| 32 | |||
| 33 | public function getName(): string | ||
| 34 | { | ||
| 35 | return $this->name; | ||
| 36 | } | ||
| 37 | |||
| 38 | /** @psalm-return list<mixed> */ | ||
| 39 | public function getArguments(): array | ||
| 40 | { | ||
| 41 | return $this->arguments; | ||
| 42 | } | ||
| 43 | |||
| 44 | public function __toString(): string | ||
| 45 | { | ||
| 46 | return $this->name . '(' . implode(', ', $this->arguments) . ')'; | ||
| 47 | } | ||
| 48 | } | ||
diff --git a/vendor/doctrine/orm/src/Query/Expr/GroupBy.php b/vendor/doctrine/orm/src/Query/Expr/GroupBy.php new file mode 100644 index 0000000..fa4625a --- /dev/null +++ b/vendor/doctrine/orm/src/Query/Expr/GroupBy.php | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | <?php | ||
| 2 | |||
| 3 | declare(strict_types=1); | ||
| 4 | |||
| 5 | namespace Doctrine\ORM\Query\Expr; | ||
| 6 | |||
| 7 | /** | ||
| 8 | * Expression class for building DQL Group By parts. | ||
| 9 | * | ||
| 10 | * @link www.doctrine-project.org | ||
| 11 | */ | ||
| 12 | class GroupBy extends Base | ||
| 13 | { | ||
| 14 | protected string $preSeparator = ''; | ||
| 15 | protected string $postSeparator = ''; | ||
| 16 | |||
| 17 | /** @psalm-var list<string> */ | ||
| 18 | protected array $parts = []; | ||
| 19 | |||
| 20 | /** @psalm-return list<string> */ | ||
| 21 | public function getParts(): array | ||
| 22 | { | ||
| 23 | return $this->parts; | ||
| 24 | } | ||
| 25 | } | ||
diff --git a/vendor/doctrine/orm/src/Query/Expr/Join.php b/vendor/doctrine/orm/src/Query/Expr/Join.php new file mode 100644 index 0000000..c3b6dc9 --- /dev/null +++ b/vendor/doctrine/orm/src/Query/Expr/Join.php | |||
| @@ -0,0 +1,77 @@ | |||
| 1 | <?php | ||
| 2 | |||
| 3 | declare(strict_types=1); | ||
| 4 | |||
| 5 | namespace Doctrine\ORM\Query\Expr; | ||
| 6 | |||
| 7 | use Stringable; | ||
| 8 | |||
| 9 | use function strtoupper; | ||
| 10 | |||
| 11 | /** | ||
| 12 | * Expression class for DQL join. | ||
| 13 | * | ||
| 14 | * @link www.doctrine-project.org | ||
| 15 | */ | ||
| 16 | class Join implements Stringable | ||
| 17 | { | ||
| 18 | final public const INNER_JOIN = 'INNER'; | ||
| 19 | final public const LEFT_JOIN = 'LEFT'; | ||
| 20 | |||
| 21 | final public const ON = 'ON'; | ||
| 22 | final public const WITH = 'WITH'; | ||
| 23 | |||
| 24 | /** | ||
| 25 | * @psalm-param self::INNER_JOIN|self::LEFT_JOIN $joinType | ||
| 26 | * @psalm-param self::ON|self::WITH|null $conditionType | ||
| 27 | */ | ||
| 28 | public function __construct( | ||
| 29 | protected string $joinType, | ||
| 30 | protected string $join, | ||
| 31 | protected string|null $alias = null, | ||
| 32 | protected string|null $conditionType = null, | ||
| 33 | protected string|Comparison|Composite|Func|null $condition = null, | ||
| 34 | protected string|null $indexBy = null, | ||
| 35 | ) { | ||
| 36 | } | ||
| 37 | |||
| 38 | /** @psalm-return self::INNER_JOIN|self::LEFT_JOIN */ | ||
| 39 | public function getJoinType(): string | ||
| 40 | { | ||
| 41 | return $this->joinType; | ||
| 42 | } | ||
| 43 | |||
| 44 | public function getJoin(): string | ||
| 45 | { | ||
| 46 | return $this->join; | ||
| 47 | } | ||
| 48 | |||
| 49 | public function getAlias(): string|null | ||
| 50 | { | ||
| 51 | return $this->alias; | ||
| 52 | } | ||
| 53 | |||
| 54 | /** @psalm-return self::ON|self::WITH|null */ | ||
| 55 | public function getConditionType(): string|null | ||
| 56 | { | ||
| 57 | return $this->conditionType; | ||
| 58 | } | ||
| 59 | |||
| 60 | public function getCondition(): string|Comparison|Composite|Func|null | ||
| 61 | { | ||
| 62 | return $this->condition; | ||
| 63 | } | ||
| 64 | |||
| 65 | public function getIndexBy(): string|null | ||
| 66 | { | ||
| 67 | return $this->indexBy; | ||
| 68 | } | ||
| 69 | |||
| 70 | public function __toString(): string | ||
| 71 | { | ||
| 72 | return strtoupper($this->joinType) . ' JOIN ' . $this->join | ||
| 73 | . ($this->alias ? ' ' . $this->alias : '') | ||
| 74 | . ($this->indexBy ? ' INDEX BY ' . $this->indexBy : '') | ||
| 75 | . ($this->condition ? ' ' . strtoupper($this->conditionType) . ' ' . $this->condition : ''); | ||
| 76 | } | ||
| 77 | } | ||
diff --git a/vendor/doctrine/orm/src/Query/Expr/Literal.php b/vendor/doctrine/orm/src/Query/Expr/Literal.php new file mode 100644 index 0000000..0c13030 --- /dev/null +++ b/vendor/doctrine/orm/src/Query/Expr/Literal.php | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | <?php | ||
| 2 | |||
| 3 | declare(strict_types=1); | ||
| 4 | |||
| 5 | namespace Doctrine\ORM\Query\Expr; | ||
| 6 | |||
| 7 | /** | ||
| 8 | * Expression class for generating DQL functions. | ||
| 9 | * | ||
| 10 | * @link www.doctrine-project.org | ||
| 11 | */ | ||
| 12 | class Literal extends Base | ||
| 13 | { | ||
| 14 | protected string $preSeparator = ''; | ||
| 15 | protected string $postSeparator = ''; | ||
| 16 | |||
| 17 | /** @psalm-var list<string> */ | ||
| 18 | protected array $parts = []; | ||
| 19 | |||
| 20 | /** @psalm-return list<string> */ | ||
| 21 | public function getParts(): array | ||
| 22 | { | ||
| 23 | return $this->parts; | ||
| 24 | } | ||
| 25 | } | ||
diff --git a/vendor/doctrine/orm/src/Query/Expr/Math.php b/vendor/doctrine/orm/src/Query/Expr/Math.php new file mode 100644 index 0000000..05e0b39 --- /dev/null +++ b/vendor/doctrine/orm/src/Query/Expr/Math.php | |||
| @@ -0,0 +1,59 @@ | |||
| 1 | <?php | ||
| 2 | |||
| 3 | declare(strict_types=1); | ||
| 4 | |||
| 5 | namespace Doctrine\ORM\Query\Expr; | ||
| 6 | |||
| 7 | use Stringable; | ||
| 8 | |||
| 9 | /** | ||
| 10 | * Expression class for DQL math statements. | ||
| 11 | * | ||
| 12 | * @link www.doctrine-project.org | ||
| 13 | */ | ||
| 14 | class Math implements Stringable | ||
| 15 | { | ||
| 16 | /** | ||
| 17 | * Creates a mathematical expression with the given arguments. | ||
| 18 | */ | ||
| 19 | public function __construct( | ||
| 20 | protected mixed $leftExpr, | ||
| 21 | protected string $operator, | ||
| 22 | protected mixed $rightExpr, | ||
| 23 | ) { | ||
| 24 | } | ||
| 25 | |||
| 26 | public function getLeftExpr(): mixed | ||
| 27 | { | ||
| 28 | return $this->leftExpr; | ||
| 29 | } | ||
| 30 | |||
| 31 | public function getOperator(): string | ||
| 32 | { | ||
| 33 | return $this->operator; | ||
| 34 | } | ||
| 35 | |||
| 36 | public function getRightExpr(): mixed | ||
| 37 | { | ||
| 38 | return $this->rightExpr; | ||
| 39 | } | ||
| 40 | |||
| 41 | public function __toString(): string | ||
| 42 | { | ||
| 43 | // Adjusting Left Expression | ||
| 44 | $leftExpr = (string) $this->leftExpr; | ||
| 45 | |||
| 46 | if ($this->leftExpr instanceof Math) { | ||
| 47 | $leftExpr = '(' . $leftExpr . ')'; | ||
| 48 | } | ||
| 49 | |||
| 50 | // Adjusting Right Expression | ||
| 51 | $rightExpr = (string) $this->rightExpr; | ||
| 52 | |||
| 53 | if ($this->rightExpr instanceof Math) { | ||
| 54 | $rightExpr = '(' . $rightExpr . ')'; | ||
| 55 | } | ||
| 56 | |||
| 57 | return $leftExpr . ' ' . $this->operator . ' ' . $rightExpr; | ||
| 58 | } | ||
| 59 | } | ||
diff --git a/vendor/doctrine/orm/src/Query/Expr/OrderBy.php b/vendor/doctrine/orm/src/Query/Expr/OrderBy.php new file mode 100644 index 0000000..ac9e160 --- /dev/null +++ b/vendor/doctrine/orm/src/Query/Expr/OrderBy.php | |||
| @@ -0,0 +1,60 @@ | |||
| 1 | <?php | ||
| 2 | |||
| 3 | declare(strict_types=1); | ||
| 4 | |||
| 5 | namespace Doctrine\ORM\Query\Expr; | ||
| 6 | |||
| 7 | use Stringable; | ||
| 8 | |||
| 9 | use function count; | ||
| 10 | use function implode; | ||
| 11 | |||
| 12 | /** | ||
| 13 | * Expression class for building DQL Order By parts. | ||
| 14 | * | ||
| 15 | * @link www.doctrine-project.org | ||
| 16 | */ | ||
| 17 | class OrderBy implements Stringable | ||
| 18 | { | ||
| 19 | protected string $preSeparator = ''; | ||
| 20 | protected string $separator = ', '; | ||
| 21 | protected string $postSeparator = ''; | ||
| 22 | |||
| 23 | /** @var string[] */ | ||
| 24 | protected array $allowedClasses = []; | ||
| 25 | |||
| 26 | /** @psalm-var list<string> */ | ||
| 27 | protected array $parts = []; | ||
| 28 | |||
| 29 | public function __construct( | ||
| 30 | string|null $sort = null, | ||
| 31 | string|null $order = null, | ||
| 32 | ) { | ||
| 33 | if ($sort) { | ||
| 34 | $this->add($sort, $order); | ||
| 35 | } | ||
| 36 | } | ||
| 37 | |||
| 38 | public function add(string $sort, string|null $order = null): void | ||
| 39 | { | ||
| 40 | $order = ! $order ? 'ASC' : $order; | ||
| 41 | $this->parts[] = $sort . ' ' . $order; | ||
| 42 | } | ||
| 43 | |||
| 44 | /** @psalm-return 0|positive-int */ | ||
| 45 | public function count(): int | ||
| 46 | { | ||
| 47 | return count($this->parts); | ||
| 48 | } | ||
| 49 | |||
| 50 | /** @psalm-return list<string> */ | ||
| 51 | public function getParts(): array | ||
| 52 | { | ||
| 53 | return $this->parts; | ||
| 54 | } | ||
| 55 | |||
| 56 | public function __toString(): string | ||
| 57 | { | ||
| 58 | return $this->preSeparator . implode($this->separator, $this->parts) . $this->postSeparator; | ||
| 59 | } | ||
| 60 | } | ||
diff --git a/vendor/doctrine/orm/src/Query/Expr/Orx.php b/vendor/doctrine/orm/src/Query/Expr/Orx.php new file mode 100644 index 0000000..2ae2332 --- /dev/null +++ b/vendor/doctrine/orm/src/Query/Expr/Orx.php | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | <?php | ||
| 2 | |||
| 3 | declare(strict_types=1); | ||
| 4 | |||
| 5 | namespace Doctrine\ORM\Query\Expr; | ||
| 6 | |||
| 7 | /** | ||
| 8 | * Expression class for building DQL OR clauses. | ||
| 9 | * | ||
| 10 | * @link www.doctrine-project.org | ||
| 11 | */ | ||
| 12 | class Orx extends Composite | ||
| 13 | { | ||
| 14 | protected string $separator = ' OR '; | ||
| 15 | |||
| 16 | /** @var string[] */ | ||
| 17 | protected array $allowedClasses = [ | ||
| 18 | Comparison::class, | ||
| 19 | Func::class, | ||
| 20 | Andx::class, | ||
| 21 | self::class, | ||
| 22 | ]; | ||
| 23 | |||
| 24 | /** @psalm-var list<string|Comparison|Func|Andx|self> */ | ||
| 25 | protected array $parts = []; | ||
| 26 | |||
| 27 | /** @psalm-return list<string|Comparison|Func|Andx|self> */ | ||
| 28 | public function getParts(): array | ||
| 29 | { | ||
| 30 | return $this->parts; | ||
| 31 | } | ||
| 32 | } | ||
diff --git a/vendor/doctrine/orm/src/Query/Expr/Select.php b/vendor/doctrine/orm/src/Query/Expr/Select.php new file mode 100644 index 0000000..91b0b60 --- /dev/null +++ b/vendor/doctrine/orm/src/Query/Expr/Select.php | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | <?php | ||
| 2 | |||
| 3 | declare(strict_types=1); | ||
| 4 | |||
| 5 | namespace Doctrine\ORM\Query\Expr; | ||
| 6 | |||
| 7 | /** | ||
| 8 | * Expression class for building DQL select statements. | ||
| 9 | * | ||
| 10 | * @link www.doctrine-project.org | ||
| 11 | */ | ||
| 12 | class Select extends Base | ||
| 13 | { | ||
| 14 | protected string $preSeparator = ''; | ||
| 15 | protected string $postSeparator = ''; | ||
| 16 | |||
| 17 | /** @var string[] */ | ||
| 18 | protected array $allowedClasses = [Func::class]; | ||
| 19 | |||
| 20 | /** @psalm-var list<string|Func> */ | ||
| 21 | protected array $parts = []; | ||
| 22 | |||
| 23 | /** @psalm-return list<string|Func> */ | ||
| 24 | public function getParts(): array | ||
| 25 | { | ||
| 26 | return $this->parts; | ||
| 27 | } | ||
| 28 | } | ||
