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