[TASK] Extbase (Persistence): Removed PreparedQuery for now, as it is not used at...
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Classes / Persistence / QueryInterface.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
6 * All rights reserved
7 *
8 * This class is a backport of the corresponding class of FLOW3.
9 * All credits go to the v5 team.
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 *
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27
28 /**
29 * A persistence query interface
30 *
31 * @package Extbase
32 * @subpackage Persistence
33 * @version $Id: QueryInterface.php 658 2009-05-16 13:54:16Z jocrau $
34 */
35 interface Tx_Extbase_Persistence_QueryInterface {
36
37 /**
38 * Constants representing the direction when ordering result sets.
39 */
40 const ORDER_ASCENDING = 'ASC';
41 const ORDER_DESCENDING = 'DESC';
42
43 /**
44 * Executes the query against the backend and returns the result
45 *
46 * @return array<object> The query result as an array of objects
47 * @api
48 */
49 public function execute();
50
51 /**
52 * Sets the property names to order the result by. Expected like this:
53 * array(
54 * 'foo' => Tx_Extbase_Persistence_QueryInterface::ORDER_ASCENDING,
55 * 'bar' => Tx_Extbase_Persistence_QueryInterface::ORDER_DESCENDING
56 * )
57 *
58 * @param array $orderings The property names to order by
59 * @return Tx_Extbase_Persistence_QueryInterface
60 * @api
61 */
62 public function setOrderings(array $orderings);
63
64 /**
65 * Sets the maximum size of the result set to limit. Returns $this to allow
66 * for chaining (fluid interface)
67 *
68 * @param integer $limit
69 * @return Tx_Extbase_Persistence_QueryInterface
70 * @api
71 */
72 public function setLimit($limit);
73
74 /**
75 * Sets the start offset of the result set to offset. Returns $this to
76 * allow for chaining (fluid interface)
77 *
78 * @param integer $offset
79 * @return Tx_Extbase_Persistence_QueryInterface
80 * @api
81 */
82 public function setOffset($offset);
83
84 /**
85 * The constraint used to limit the result set. Returns $this to allow
86 * for chaining (fluid interface)
87 *
88 * @param object $constraint Some constraint, depending on the backend
89 * @return Tx_Extbase_Persistence_QueryInterface
90 * @api
91 */
92 public function matching($constraint);
93
94 /**
95 * Performs a logical conjunction of the two given constraints.
96 *
97 * @param object $constraint1 First constraint
98 * @param object $constraint2 Second constraint
99 * @return object
100 * @api
101 */
102 public function logicalAnd($constraint1, $constraint2);
103
104 /**
105 * Performs a logical disjunction of the two given constraints
106 *
107 * @param object $constraint1 First constraint
108 * @param object $constraint2 Second constraint
109 * @return object
110 * @api
111 */
112 public function logicalOr($constraint1, $constraint2);
113
114 /**
115 * Performs a logical negation of the given constraint
116 *
117 * @param object $constraint Constraint to negate
118 * @return object
119 * @api
120 */
121 public function logicalNot($constraint);
122
123 /**
124 * Matches against the (internal) identifier.
125 *
126 * @param string $uid An identifier to match against
127 * @return object
128 * @api
129 */
130 public function withUid($uid);
131
132 /**
133 * Returns an equals criterion used for matching objects against a query
134 *
135 * @param string $propertyName The name of the property to compare against
136 * @param mixed $operand The value to compare with
137 * @param boolean $caseSensitive Whether the equality test should be done case-sensitive
138 * @return object
139 * @api
140 */
141 public function equals($propertyName, $operand, $caseSensitive = TRUE);
142
143 /**
144 * Returns a like criterion used for matching objects against a query
145 *
146 * @param string $propertyName The name of the property to compare against
147 * @param mixed $operand The value to compare with
148 * @return object
149 * @api
150 */
151 public function like($propertyName, $operand);
152
153 /**
154 * Returns a less than criterion used for matching objects against a query
155 *
156 * @param string $propertyName The name of the property to compare against
157 * @param mixed $operand The value to compare with
158 * @return object
159 * @api
160 */
161 public function lessThan($propertyName, $operand);
162
163 /**
164 * Returns a less or equal than criterion used for matching objects against a query
165 *
166 * @param string $propertyName The name of the property to compare against
167 * @param mixed $operand The value to compare with
168 * @return object
169 * @api
170 */
171 public function lessThanOrEqual($propertyName, $operand);
172
173 /**
174 * Returns a greater than criterion used for matching objects against a query
175 *
176 * @param string $propertyName The name of the property to compare against
177 * @param mixed $operand The value to compare with
178 * @return object
179 * @api
180 */
181 public function greaterThan($propertyName, $operand);
182
183 /**
184 * Returns a greater than or equal criterion used for matching objects against a query
185 *
186 * @param string $propertyName The name of the property to compare against
187 * @param mixed $operand The value to compare with
188 * @return object
189 * @api
190 */
191 public function greaterThanOrEqual($propertyName, $operand);
192
193 }
194 ?>