* Adding API annotations to classes
[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 * @api
35 */
36 interface Tx_Extbase_Persistence_QueryInterface {
37
38 /**
39 * Constants representing the direction when ordering result sets.
40 */
41 const ORDER_ASCENDING = 'ASC';
42 const ORDER_DESCENDING = 'DESC';
43
44 /**
45 * Executes the query against the backend and returns the result
46 *
47 * @return array<object> The query result as an array of objects
48 * @api
49 */
50 public function execute();
51
52 /**
53 * Sets the property names to order the result by. Expected like this:
54 * array(
55 * 'foo' => Tx_Extbase_Persistence_QueryInterface::ORDER_ASCENDING,
56 * 'bar' => Tx_Extbase_Persistence_QueryInterface::ORDER_DESCENDING
57 * )
58 *
59 * @param array $orderings The property names to order by
60 * @return Tx_Extbase_Persistence_QueryInterface
61 * @api
62 */
63 public function setOrderings(array $orderings);
64
65 /**
66 * Sets the maximum size of the result set to limit. Returns $this to allow
67 * for chaining (fluid interface)
68 *
69 * @param integer $limit
70 * @return Tx_Extbase_Persistence_QueryInterface
71 * @api
72 */
73 public function setLimit($limit);
74
75 /**
76 * Sets the start offset of the result set to offset. Returns $this to
77 * allow for chaining (fluid interface)
78 *
79 * @param integer $offset
80 * @return Tx_Extbase_Persistence_QueryInterface
81 * @api
82 */
83 public function setOffset($offset);
84
85 /**
86 * The constraint used to limit the result set. Returns $this to allow
87 * for chaining (fluid interface)
88 *
89 * @param object $constraint Some constraint, depending on the backend
90 * @return Tx_Extbase_Persistence_QueryInterface
91 * @api
92 */
93 public function matching($constraint);
94
95 /**
96 * Performs a logical conjunction of the two given constraints.
97 *
98 * @param object $constraint1 First constraint
99 * @param object $constraint2 Second constraint
100 * @return object
101 * @api
102 */
103 public function logicalAnd($constraint1, $constraint2);
104
105 /**
106 * Performs a logical disjunction of the two given constraints
107 *
108 * @param object $constraint1 First constraint
109 * @param object $constraint2 Second constraint
110 * @return object
111 * @api
112 */
113 public function logicalOr($constraint1, $constraint2);
114
115 /**
116 * Performs a logical negation of the given constraint
117 *
118 * @param object $constraint Constraint to negate
119 * @return object
120 * @api
121 */
122 public function logicalNot($constraint);
123
124 /**
125 * Matches against the (internal) identifier.
126 *
127 * @param string $uid An identifier to match against
128 * @return object
129 * @api
130 */
131 public function withUid($uid);
132
133 /**
134 * Returns an equals criterion used for matching objects against a query
135 *
136 * @param string $propertyName The name of the property to compare against
137 * @param mixed $operand The value to compare with
138 * @param boolean $caseSensitive Whether the equality test should be done case-sensitive
139 * @return object
140 * @api
141 */
142 public function equals($propertyName, $operand, $caseSensitive = TRUE);
143
144 /**
145 * Returns a like criterion used for matching objects against a query
146 *
147 * @param string $propertyName The name of the property to compare against
148 * @param mixed $operand The value to compare with
149 * @return object
150 * @api
151 */
152 public function like($propertyName, $operand);
153
154 /**
155 * Returns a less than criterion used for matching objects against a query
156 *
157 * @param string $propertyName The name of the property to compare against
158 * @param mixed $operand The value to compare with
159 * @return object
160 * @api
161 */
162 public function lessThan($propertyName, $operand);
163
164 /**
165 * Returns a less or equal than criterion used for matching objects against a query
166 *
167 * @param string $propertyName The name of the property to compare against
168 * @param mixed $operand The value to compare with
169 * @return object
170 * @api
171 */
172 public function lessThanOrEqual($propertyName, $operand);
173
174 /**
175 * Returns a greater than criterion used for matching objects against a query
176 *
177 * @param string $propertyName The name of the property to compare against
178 * @param mixed $operand The value to compare with
179 * @return object
180 * @api
181 */
182 public function greaterThan($propertyName, $operand);
183
184 /**
185 * Returns a greater than or equal criterion used for matching objects against a query
186 *
187 * @param string $propertyName The name of the property to compare against
188 * @param mixed $operand The value to compare with
189 * @return object
190 * @api
191 */
192 public function greaterThanOrEqual($propertyName, $operand);
193
194 }
195 ?>