[TASK] Adjust phpdoc for classes (files) of backports
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Classes / Persistence / Generic / Qom / Comparison.php
1 <?php
2 namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
3
4 /***************************************************************
5 * Copyright notice
6 *
7 * This class is a backport of the corresponding class of TYPO3 Flow.
8 * All credits go to the TYPO3 Flow team.
9 * All rights reserved
10 *
11 * This script is part of the TYPO3 project. The TYPO3 project is
12 * free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * The GNU General Public License can be found at
18 * http://www.gnu.org/copyleft/gpl.html.
19 * A copy is found in the textfile GPL.txt and important notices to the license
20 * from the author is found in LICENSE.txt distributed with these scripts.
21 *
22 *
23 * This script is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
27 *
28 * This copyright notice MUST APPEAR in all copies of the script!
29 ***************************************************************/
30 /**
31 * Filters node-tuples based on the outcome of a binary operation.
32 *
33 * For any comparison, operand2 always evaluates to a scalar value. In contrast,
34 * operand1 may evaluate to an array of values (for example, the value of a multi-valued
35 * property), in which case the comparison is separately performed for each element
36 * of the array, and the Comparison constraint is satisfied as a whole if the
37 * comparison against any element of the array is satisfied.
38 *
39 * If operand1 and operand2 evaluate to values of different property types, the
40 * value of operand2 is converted to the property type of the value of operand1.
41 * If the type conversion fails, the query is invalid.
42 *
43 * If operator is not supported for the property type of operand1, the query is invalid.
44 *
45 * If operand1 evaluates to null (for example, if the operand evaluates the value
46 * of a property which does not exist), the constraint is not satisfied.
47 *
48 * The JCR_OPERATOR_EQUAL_TO operator is satisfied only if the value of operand1
49 * equals the value of operand2.
50 *
51 * The JCR_OPERATOR_NOT_EQUAL_TO operator is satisfied unless the value of
52 * operand1 equals the value of operand2.
53 *
54 * The JCR_OPERATOR_LESSS_THAN operator is satisfied only if the value of
55 * operand1 is ordered before the value of operand2.
56 *
57 * The JCR_OPERATOR_LESS_THAN_OR_EQUAL_TO operator is satisfied unless the value
58 * of operand1 is ordered after the value of operand2.
59 *
60 * The JCR_OPERATOR_GREATER_THAN operator is satisfied only if the value of
61 * operand1 is ordered after the value of operand2.
62 *
63 * The JCR_OPERATOR_GREATER_THAN_OR_EQUAL_TO operator is satisfied unless the
64 * value of operand1 is ordered before the value of operand2.
65 *
66 * The JCR_OPERATOR_LIKE operator is satisfied only if the value of operand1
67 * matches the pattern specified by the value of operand2, where in the pattern:
68 * the character "%" matches zero or more characters, and
69 * the character "_" (underscore) matches exactly one character, and
70 * the string "\x" matches the character "x", and
71 * all other characters match themselves.
72 *
73 * @scope prototype
74 */
75 class Comparison implements \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ComparisonInterface {
76
77 /**
78 * @var \TYPO3\CMS\Extbase\Persistence\Generic\Qom\DynamicOperandInterface
79 */
80 protected $operand1;
81
82 /**
83 * @var integer
84 */
85 protected $operator;
86
87 /**
88 * @var mixed
89 */
90 protected $operand2;
91
92 /**
93 * Constructs this Comparison instance
94 *
95 * @param \TYPO3\CMS\Extbase\Persistence\Generic\Qom\DynamicOperandInterface $operand1
96 * @param int $operator one of \TYPO3\CMS\Extbase\Persistence\QueryInterface.OPERATOR_*
97 * @param mixed $operand2
98 */
99 public function __construct(\TYPO3\CMS\Extbase\Persistence\Generic\Qom\DynamicOperandInterface $operand1, $operator, $operand2) {
100 $this->operand1 = $operand1;
101 $this->operator = $operator;
102 $this->operand2 = $operand2;
103 }
104
105 /**
106 * Gets the first operand.
107 *
108 * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\DynamicOperandInterface the operand; non-null
109 */
110 public function getOperand1() {
111 return $this->operand1;
112 }
113
114 /**
115 * Gets the operator.
116 *
117 * @return string one of \TYPO3\CMS\Extbase\Persistence\Generic\Qom\QueryObjectModelConstantsInterface.JCR_OPERATOR_*
118 */
119 public function getOperator() {
120 return $this->operator;
121 }
122
123 /**
124 * Gets the second operand.
125 *
126 * @return mixed the operand; non-null
127 */
128 public function getOperand2() {
129 return $this->operand2;
130 }
131
132 }
133
134
135 ?>