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/collections/src/Expr/Comparison.php | |
parent | 94d67a4b51f8e62e7d518cce26a526ae1ec48278 (diff) | |
download | AppliGestionPHP-bf6655a534a6775d30cafa67bd801276bda1d98d.zip |
VERSION 0.2 doctrine ORM et entités
Diffstat (limited to 'vendor/doctrine/collections/src/Expr/Comparison.php')
-rw-r--r-- | vendor/doctrine/collections/src/Expr/Comparison.php | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/vendor/doctrine/collections/src/Expr/Comparison.php b/vendor/doctrine/collections/src/Expr/Comparison.php new file mode 100644 index 0000000..f1ea07f --- /dev/null +++ b/vendor/doctrine/collections/src/Expr/Comparison.php | |||
@@ -0,0 +1,62 @@ | |||
1 | <?php | ||
2 | |||
3 | declare(strict_types=1); | ||
4 | |||
5 | namespace Doctrine\Common\Collections\Expr; | ||
6 | |||
7 | /** | ||
8 | * Comparison of a field with a value by the given operator. | ||
9 | */ | ||
10 | class Comparison implements Expression | ||
11 | { | ||
12 | final public const EQ = '='; | ||
13 | final public const NEQ = '<>'; | ||
14 | final public const LT = '<'; | ||
15 | final public const LTE = '<='; | ||
16 | final public const GT = '>'; | ||
17 | final public const GTE = '>='; | ||
18 | final public const IS = '='; // no difference with EQ | ||
19 | final public const IN = 'IN'; | ||
20 | final public const NIN = 'NIN'; | ||
21 | final public const CONTAINS = 'CONTAINS'; | ||
22 | final public const MEMBER_OF = 'MEMBER_OF'; | ||
23 | final public const STARTS_WITH = 'STARTS_WITH'; | ||
24 | final public const ENDS_WITH = 'ENDS_WITH'; | ||
25 | |||
26 | private readonly Value $value; | ||
27 | |||
28 | public function __construct(private readonly string $field, private readonly string $op, mixed $value) | ||
29 | { | ||
30 | if (! ($value instanceof Value)) { | ||
31 | $value = new Value($value); | ||
32 | } | ||
33 | |||
34 | $this->value = $value; | ||
35 | } | ||
36 | |||
37 | /** @return string */ | ||
38 | public function getField() | ||
39 | { | ||
40 | return $this->field; | ||
41 | } | ||
42 | |||
43 | /** @return Value */ | ||
44 | public function getValue() | ||
45 | { | ||
46 | return $this->value; | ||
47 | } | ||
48 | |||
49 | /** @return string */ | ||
50 | public function getOperator() | ||
51 | { | ||
52 | return $this->op; | ||
53 | } | ||
54 | |||
55 | /** | ||
56 | * {@inheritDoc} | ||
57 | */ | ||
58 | public function visit(ExpressionVisitor $visitor) | ||
59 | { | ||
60 | return $visitor->walkComparison($this); | ||
61 | } | ||
62 | } | ||