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