/PHP/Test/vendor/doctrine/orm/lib/Doctrine/ORM/Query/TreeWalker.php
PHP | 409 lines | 53 code | 49 blank | 307 comment | 0 complexity | c9fd2dda7a4fa2c0667fac319307bf5b MD5 | raw file
1<?php
2/*
3 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
4 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
5 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
6 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
7 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
8 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
10 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
11 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
12 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
13 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14 *
15 * This software consists of voluntary contributions made by many individuals
16 * and is licensed under the MIT license. For more information, see
17 * <http://www.doctrine-project.org>.
18 */
19
20namespace Doctrine\ORM\Query;
21
22/**
23 * Interface for walkers of DQL ASTs (abstract syntax trees).
24 *
25 * @author Roman Borschel <roman@code-factory.org>
26 * @since 2.0
27 */
28interface TreeWalker
29{
30 /**
31 * Initializes TreeWalker with important information about the ASTs to be walked
32 *
33 * @param Query $query The parsed Query.
34 * @param ParserResult $parserResult The result of the parsing process.
35 * @param array $queryComponents Query components (symbol table)
36 */
37 public function __construct($query, $parserResult, array $queryComponents);
38
39 /**
40 * Walks down a SelectStatement AST node, thereby generating the appropriate SQL.
41 *
42 * @return string The SQL.
43 */
44 function walkSelectStatement(AST\SelectStatement $AST);
45
46 /**
47 * Walks down a SelectClause AST node, thereby generating the appropriate SQL.
48 *
49 * @return string The SQL.
50 */
51 function walkSelectClause($selectClause);
52
53 /**
54 * Walks down a FromClause AST node, thereby generating the appropriate SQL.
55 *
56 * @return string The SQL.
57 */
58 function walkFromClause($fromClause);
59
60 /**
61 * Walks down a FunctionNode AST node, thereby generating the appropriate SQL.
62 *
63 * @return string The SQL.
64 */
65 function walkFunction($function);
66
67 /**
68 * Walks down an OrderByClause AST node, thereby generating the appropriate SQL.
69 *
70 * @param OrderByClause
71 * @return string The SQL.
72 */
73 function walkOrderByClause($orderByClause);
74
75 /**
76 * Walks down an OrderByItem AST node, thereby generating the appropriate SQL.
77 *
78 * @param OrderByItem
79 * @return string The SQL.
80 */
81 function walkOrderByItem($orderByItem);
82
83 /**
84 * Walks down a HavingClause AST node, thereby generating the appropriate SQL.
85 *
86 * @param HavingClause
87 * @return string The SQL.
88 */
89 function walkHavingClause($havingClause);
90
91 /**
92 * Walks down a Join AST node and creates the corresponding SQL.
93 *
94 * @param Join $joinVarDecl
95 * @return string The SQL.
96 */
97 function walkJoin($join);
98
99 /**
100 * Walks down a SelectExpression AST node and generates the corresponding SQL.
101 *
102 * @param SelectExpression $selectExpression
103 * @return string The SQL.
104 */
105 function walkSelectExpression($selectExpression);
106
107 /**
108 * Walks down a QuantifiedExpression AST node, thereby generating the appropriate SQL.
109 *
110 * @param QuantifiedExpression
111 * @return string The SQL.
112 */
113 function walkQuantifiedExpression($qExpr);
114
115 /**
116 * Walks down a Subselect AST node, thereby generating the appropriate SQL.
117 *
118 * @param Subselect
119 * @return string The SQL.
120 */
121 function walkSubselect($subselect);
122
123 /**
124 * Walks down a SubselectFromClause AST node, thereby generating the appropriate SQL.
125 *
126 * @param SubselectFromClause
127 * @return string The SQL.
128 */
129 function walkSubselectFromClause($subselectFromClause);
130
131 /**
132 * Walks down a SimpleSelectClause AST node, thereby generating the appropriate SQL.
133 *
134 * @param SimpleSelectClause
135 * @return string The SQL.
136 */
137 function walkSimpleSelectClause($simpleSelectClause);
138
139 /**
140 * Walks down a SimpleSelectExpression AST node, thereby generating the appropriate SQL.
141 *
142 * @param SimpleSelectExpression
143 * @return string The SQL.
144 */
145 function walkSimpleSelectExpression($simpleSelectExpression);
146
147 /**
148 * Walks down an AggregateExpression AST node, thereby generating the appropriate SQL.
149 *
150 * @param AggregateExpression
151 * @return string The SQL.
152 */
153 function walkAggregateExpression($aggExpression);
154
155 /**
156 * Walks down a GroupByClause AST node, thereby generating the appropriate SQL.
157 *
158 * @param GroupByClause
159 * @return string The SQL.
160 */
161 function walkGroupByClause($groupByClause);
162
163 /**
164 * Walks down a GroupByItem AST node, thereby generating the appropriate SQL.
165 *
166 * @param GroupByItem
167 * @return string The SQL.
168 */
169 function walkGroupByItem($groupByItem);
170
171 /**
172 * Walks down an UpdateStatement AST node, thereby generating the appropriate SQL.
173 *
174 * @param UpdateStatement
175 * @return string The SQL.
176 */
177 function walkUpdateStatement(AST\UpdateStatement $AST);
178
179 /**
180 * Walks down a DeleteStatement AST node, thereby generating the appropriate SQL.
181 *
182 * @param DeleteStatement
183 * @return string The SQL.
184 */
185 function walkDeleteStatement(AST\DeleteStatement $AST);
186
187 /**
188 * Walks down a DeleteClause AST node, thereby generating the appropriate SQL.
189 *
190 * @param DeleteClause
191 * @return string The SQL.
192 */
193 function walkDeleteClause(AST\DeleteClause $deleteClause);
194
195 /**
196 * Walks down an UpdateClause AST node, thereby generating the appropriate SQL.
197 *
198 * @param UpdateClause
199 * @return string The SQL.
200 */
201 function walkUpdateClause($updateClause);
202
203 /**
204 * Walks down an UpdateItem AST node, thereby generating the appropriate SQL.
205 *
206 * @param UpdateItem
207 * @return string The SQL.
208 */
209 function walkUpdateItem($updateItem);
210
211 /**
212 * Walks down a WhereClause AST node, thereby generating the appropriate SQL.
213 *
214 * @param WhereClause
215 * @return string The SQL.
216 */
217 function walkWhereClause($whereClause);
218
219 /**
220 * Walks down a ConditionalExpression AST node, thereby generating the appropriate SQL.
221 *
222 * @param ConditionalExpression
223 * @return string The SQL.
224 */
225 function walkConditionalExpression($condExpr);
226
227 /**
228 * Walks down a ConditionalTerm AST node, thereby generating the appropriate SQL.
229 *
230 * @param ConditionalTerm
231 * @return string The SQL.
232 */
233 function walkConditionalTerm($condTerm);
234
235 /**
236 * Walks down a ConditionalFactor AST node, thereby generating the appropriate SQL.
237 *
238 * @param ConditionalFactor
239 * @return string The SQL.
240 */
241 function walkConditionalFactor($factor);
242
243 /**
244 * Walks down a ConditionalPrimary AST node, thereby generating the appropriate SQL.
245 *
246 * @param ConditionalPrimary
247 * @return string The SQL.
248 */
249 function walkConditionalPrimary($primary);
250
251 /**
252 * Walks down an ExistsExpression AST node, thereby generating the appropriate SQL.
253 *
254 * @param ExistsExpression
255 * @return string The SQL.
256 */
257 function walkExistsExpression($existsExpr);
258
259 /**
260 * Walks down a CollectionMemberExpression AST node, thereby generating the appropriate SQL.
261 *
262 * @param CollectionMemberExpression
263 * @return string The SQL.
264 */
265 function walkCollectionMemberExpression($collMemberExpr);
266
267 /**
268 * Walks down an EmptyCollectionComparisonExpression AST node, thereby generating the appropriate SQL.
269 *
270 * @param EmptyCollectionComparisonExpression
271 * @return string The SQL.
272 */
273 function walkEmptyCollectionComparisonExpression($emptyCollCompExpr);
274
275 /**
276 * Walks down a NullComparisonExpression AST node, thereby generating the appropriate SQL.
277 *
278 * @param NullComparisonExpression
279 * @return string The SQL.
280 */
281 function walkNullComparisonExpression($nullCompExpr);
282
283 /**
284 * Walks down an InExpression AST node, thereby generating the appropriate SQL.
285 *
286 * @param InExpression
287 * @return string The SQL.
288 */
289 function walkInExpression($inExpr);
290
291 /**
292 * Walks down an InstanceOfExpression AST node, thereby generating the appropriate SQL.
293 *
294 * @param InstanceOfExpression
295 * @return string The SQL.
296 */
297 function walkInstanceOfExpression($instanceOfExpr);
298
299 /**
300 * Walks down a literal that represents an AST node, thereby generating the appropriate SQL.
301 *
302 * @param mixed
303 * @return string The SQL.
304 */
305 function walkLiteral($literal);
306
307 /**
308 * Walks down a BetweenExpression AST node, thereby generating the appropriate SQL.
309 *
310 * @param BetweenExpression
311 * @return string The SQL.
312 */
313 function walkBetweenExpression($betweenExpr);
314
315 /**
316 * Walks down a LikeExpression AST node, thereby generating the appropriate SQL.
317 *
318 * @param LikeExpression
319 * @return string The SQL.
320 */
321 function walkLikeExpression($likeExpr);
322
323 /**
324 * Walks down a StateFieldPathExpression AST node, thereby generating the appropriate SQL.
325 *
326 * @param StateFieldPathExpression
327 * @return string The SQL.
328 */
329 function walkStateFieldPathExpression($stateFieldPathExpression);
330
331 /**
332 * Walks down a ComparisonExpression AST node, thereby generating the appropriate SQL.
333 *
334 * @param ComparisonExpression
335 * @return string The SQL.
336 */
337 function walkComparisonExpression($compExpr);
338
339 /**
340 * Walks down an InputParameter AST node, thereby generating the appropriate SQL.
341 *
342 * @param InputParameter
343 * @return string The SQL.
344 */
345 function walkInputParameter($inputParam);
346
347 /**
348 * Walks down an ArithmeticExpression AST node, thereby generating the appropriate SQL.
349 *
350 * @param ArithmeticExpression
351 * @return string The SQL.
352 */
353 function walkArithmeticExpression($arithmeticExpr);
354
355 /**
356 * Walks down an ArithmeticTerm AST node, thereby generating the appropriate SQL.
357 *
358 * @param mixed
359 * @return string The SQL.
360 */
361 function walkArithmeticTerm($term);
362
363 /**
364 * Walks down a StringPrimary that represents an AST node, thereby generating the appropriate SQL.
365 *
366 * @param mixed
367 * @return string The SQL.
368 */
369 function walkStringPrimary($stringPrimary);
370
371 /**
372 * Walks down an ArithmeticFactor that represents an AST node, thereby generating the appropriate SQL.
373 *
374 * @param mixed
375 * @return string The SQL.
376 */
377 function walkArithmeticFactor($factor);
378
379 /**
380 * Walks down an SimpleArithmeticExpression AST node, thereby generating the appropriate SQL.
381 *
382 * @param SimpleArithmeticExpression
383 * @return string The SQL.
384 */
385 function walkSimpleArithmeticExpression($simpleArithmeticExpr);
386
387 /**
388 * Walks down an PathExpression AST node, thereby generating the appropriate SQL.
389 *
390 * @param mixed
391 * @return string The SQL.
392 */
393 function walkPathExpression($pathExpr);
394
395 /**
396 * Walks down an ResultVariable AST node, thereby generating the appropriate SQL.
397 *
398 * @param string $resultVariable
399 * @return string The SQL.
400 */
401 function walkResultVariable($resultVariable);
402
403 /**
404 * Gets an executor that can be used to execute the result of this walker.
405 *
406 * @return AbstractExecutor
407 */
408 function getExecutor($AST);
409}