AST
9 months ago
Exec
9 months ago
Expr
9 months ago
Filter
9 months ago
Expr.php
9 months ago
FilterCollection.php
9 months ago
Lexer.php
9 months ago
OutputWalker.php
9 months ago
Parameter.php
9 months ago
ParameterTypeInferer.php
9 months ago
Parser.php
9 months ago
ParserResult.php
9 months ago
Printer.php
9 months ago
QueryException.php
9 months ago
QueryExpressionVisitor.php
9 months ago
ResultSetMapping.php
9 months ago
ResultSetMappingBuilder.php
9 months ago
SqlOutputWalker.php
9 months ago
SqlWalker.php
9 months ago
TokenType.php
9 months ago
TreeWalker.php
9 months ago
TreeWalkerAdapter.php
9 months ago
TreeWalkerChain.php
9 months ago
TreeWalkerChainIterator.php
9 months ago
index.php
9 months ago
TreeWalkerChain.php
370 lines
| 1 | <?php |
| 2 | declare (strict_types=1); |
| 3 | namespace MailPoetVendor\Doctrine\ORM\Query; |
| 4 | if (!defined('ABSPATH')) exit; |
| 5 | use MailPoetVendor\Doctrine\Deprecations\Deprecation; |
| 6 | use MailPoetVendor\Doctrine\ORM\AbstractQuery; |
| 7 | use Generator; |
| 8 | use function array_diff; |
| 9 | use function array_keys; |
| 10 | class TreeWalkerChain implements TreeWalker |
| 11 | { |
| 12 | private $walkers = []; |
| 13 | private $query; |
| 14 | private $parserResult; |
| 15 | private $queryComponents; |
| 16 | public function getQueryComponents() |
| 17 | { |
| 18 | return $this->queryComponents; |
| 19 | } |
| 20 | public function setQueryComponent($dqlAlias, array $queryComponent) |
| 21 | { |
| 22 | $requiredKeys = ['metadata', 'parent', 'relation', 'map', 'nestingLevel', 'token']; |
| 23 | if (array_diff($requiredKeys, array_keys($queryComponent))) { |
| 24 | throw QueryException::invalidQueryComponent($dqlAlias); |
| 25 | } |
| 26 | $this->queryComponents[$dqlAlias] = $queryComponent; |
| 27 | } |
| 28 | public function __construct($query, $parserResult, array $queryComponents) |
| 29 | { |
| 30 | $this->query = $query; |
| 31 | $this->parserResult = $parserResult; |
| 32 | $this->queryComponents = $queryComponents; |
| 33 | } |
| 34 | public function addTreeWalker($walkerClass) |
| 35 | { |
| 36 | $this->walkers[] = $walkerClass; |
| 37 | } |
| 38 | public function walkSelectStatement(AST\SelectStatement $AST) |
| 39 | { |
| 40 | foreach ($this->getWalkers() as $walker) { |
| 41 | $walker->walkSelectStatement($AST); |
| 42 | $this->queryComponents = $walker->getQueryComponents(); |
| 43 | } |
| 44 | } |
| 45 | public function walkSelectClause($selectClause) |
| 46 | { |
| 47 | Deprecation::trigger('doctrine/orm', 'https://github.com/doctrine/orm/pull/9551', 'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.', __METHOD__); |
| 48 | foreach ($this->getWalkers() as $walker) { |
| 49 | $walker->walkSelectClause($selectClause); |
| 50 | } |
| 51 | } |
| 52 | public function walkFromClause($fromClause) |
| 53 | { |
| 54 | Deprecation::trigger('doctrine/orm', 'https://github.com/doctrine/orm/pull/9551', 'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.', __METHOD__); |
| 55 | foreach ($this->getWalkers() as $walker) { |
| 56 | $walker->walkFromClause($fromClause); |
| 57 | } |
| 58 | } |
| 59 | public function walkFunction($function) |
| 60 | { |
| 61 | Deprecation::trigger('doctrine/orm', 'https://github.com/doctrine/orm/pull/9551', 'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.', __METHOD__); |
| 62 | foreach ($this->getWalkers() as $walker) { |
| 63 | $walker->walkFunction($function); |
| 64 | } |
| 65 | } |
| 66 | public function walkOrderByClause($orderByClause) |
| 67 | { |
| 68 | Deprecation::trigger('doctrine/orm', 'https://github.com/doctrine/orm/pull/9551', 'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.', __METHOD__); |
| 69 | foreach ($this->getWalkers() as $walker) { |
| 70 | $walker->walkOrderByClause($orderByClause); |
| 71 | } |
| 72 | } |
| 73 | public function walkOrderByItem($orderByItem) |
| 74 | { |
| 75 | Deprecation::trigger('doctrine/orm', 'https://github.com/doctrine/orm/pull/9551', 'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.', __METHOD__); |
| 76 | foreach ($this->getWalkers() as $walker) { |
| 77 | $walker->walkOrderByItem($orderByItem); |
| 78 | } |
| 79 | } |
| 80 | public function walkHavingClause($havingClause) |
| 81 | { |
| 82 | Deprecation::trigger('doctrine/orm', 'https://github.com/doctrine/orm/pull/9551', 'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.', __METHOD__); |
| 83 | foreach ($this->getWalkers() as $walker) { |
| 84 | $walker->walkHavingClause($havingClause); |
| 85 | } |
| 86 | } |
| 87 | public function walkJoin($join) |
| 88 | { |
| 89 | Deprecation::trigger('doctrine/orm', 'https://github.com/doctrine/orm/pull/9551', 'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.', __METHOD__); |
| 90 | foreach ($this->getWalkers() as $walker) { |
| 91 | $walker->walkJoin($join); |
| 92 | } |
| 93 | } |
| 94 | public function walkSelectExpression($selectExpression) |
| 95 | { |
| 96 | Deprecation::trigger('doctrine/orm', 'https://github.com/doctrine/orm/pull/9551', 'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.', __METHOD__); |
| 97 | foreach ($this->getWalkers() as $walker) { |
| 98 | $walker->walkSelectExpression($selectExpression); |
| 99 | } |
| 100 | } |
| 101 | public function walkQuantifiedExpression($qExpr) |
| 102 | { |
| 103 | Deprecation::trigger('doctrine/orm', 'https://github.com/doctrine/orm/pull/9551', 'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.', __METHOD__); |
| 104 | foreach ($this->getWalkers() as $walker) { |
| 105 | $walker->walkQuantifiedExpression($qExpr); |
| 106 | } |
| 107 | } |
| 108 | public function walkSubselect($subselect) |
| 109 | { |
| 110 | Deprecation::trigger('doctrine/orm', 'https://github.com/doctrine/orm/pull/9551', 'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.', __METHOD__); |
| 111 | foreach ($this->getWalkers() as $walker) { |
| 112 | $walker->walkSubselect($subselect); |
| 113 | } |
| 114 | } |
| 115 | public function walkSubselectFromClause($subselectFromClause) |
| 116 | { |
| 117 | Deprecation::trigger('doctrine/orm', 'https://github.com/doctrine/orm/pull/9551', 'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.', __METHOD__); |
| 118 | foreach ($this->getWalkers() as $walker) { |
| 119 | $walker->walkSubselectFromClause($subselectFromClause); |
| 120 | } |
| 121 | } |
| 122 | public function walkSimpleSelectClause($simpleSelectClause) |
| 123 | { |
| 124 | Deprecation::trigger('doctrine/orm', 'https://github.com/doctrine/orm/pull/9551', 'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.', __METHOD__); |
| 125 | foreach ($this->getWalkers() as $walker) { |
| 126 | $walker->walkSimpleSelectClause($simpleSelectClause); |
| 127 | } |
| 128 | } |
| 129 | public function walkSimpleSelectExpression($simpleSelectExpression) |
| 130 | { |
| 131 | Deprecation::trigger('doctrine/orm', 'https://github.com/doctrine/orm/pull/9551', 'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.', __METHOD__); |
| 132 | foreach ($this->getWalkers() as $walker) { |
| 133 | $walker->walkSimpleSelectExpression($simpleSelectExpression); |
| 134 | } |
| 135 | } |
| 136 | public function walkAggregateExpression($aggExpression) |
| 137 | { |
| 138 | Deprecation::trigger('doctrine/orm', 'https://github.com/doctrine/orm/pull/9551', 'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.', __METHOD__); |
| 139 | foreach ($this->getWalkers() as $walker) { |
| 140 | $walker->walkAggregateExpression($aggExpression); |
| 141 | } |
| 142 | } |
| 143 | public function walkGroupByClause($groupByClause) |
| 144 | { |
| 145 | Deprecation::trigger('doctrine/orm', 'https://github.com/doctrine/orm/pull/9551', 'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.', __METHOD__); |
| 146 | foreach ($this->getWalkers() as $walker) { |
| 147 | $walker->walkGroupByClause($groupByClause); |
| 148 | } |
| 149 | } |
| 150 | public function walkGroupByItem($groupByItem) |
| 151 | { |
| 152 | Deprecation::trigger('doctrine/orm', 'https://github.com/doctrine/orm/pull/9551', 'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.', __METHOD__); |
| 153 | foreach ($this->getWalkers() as $walker) { |
| 154 | $walker->walkGroupByItem($groupByItem); |
| 155 | } |
| 156 | } |
| 157 | public function walkUpdateStatement(AST\UpdateStatement $AST) |
| 158 | { |
| 159 | foreach ($this->getWalkers() as $walker) { |
| 160 | $walker->walkUpdateStatement($AST); |
| 161 | } |
| 162 | } |
| 163 | public function walkDeleteStatement(AST\DeleteStatement $AST) |
| 164 | { |
| 165 | foreach ($this->getWalkers() as $walker) { |
| 166 | $walker->walkDeleteStatement($AST); |
| 167 | } |
| 168 | } |
| 169 | public function walkDeleteClause(AST\DeleteClause $deleteClause) |
| 170 | { |
| 171 | Deprecation::trigger('doctrine/orm', 'https://github.com/doctrine/orm/pull/9551', 'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.', __METHOD__); |
| 172 | foreach ($this->getWalkers() as $walker) { |
| 173 | $walker->walkDeleteClause($deleteClause); |
| 174 | } |
| 175 | } |
| 176 | public function walkUpdateClause($updateClause) |
| 177 | { |
| 178 | Deprecation::trigger('doctrine/orm', 'https://github.com/doctrine/orm/pull/9551', 'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.', __METHOD__); |
| 179 | foreach ($this->getWalkers() as $walker) { |
| 180 | $walker->walkUpdateClause($updateClause); |
| 181 | } |
| 182 | } |
| 183 | public function walkUpdateItem($updateItem) |
| 184 | { |
| 185 | Deprecation::trigger('doctrine/orm', 'https://github.com/doctrine/orm/pull/9551', 'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.', __METHOD__); |
| 186 | foreach ($this->getWalkers() as $walker) { |
| 187 | $walker->walkUpdateItem($updateItem); |
| 188 | } |
| 189 | } |
| 190 | public function walkWhereClause($whereClause) |
| 191 | { |
| 192 | Deprecation::trigger('doctrine/orm', 'https://github.com/doctrine/orm/pull/9551', 'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.', __METHOD__); |
| 193 | foreach ($this->getWalkers() as $walker) { |
| 194 | $walker->walkWhereClause($whereClause); |
| 195 | } |
| 196 | } |
| 197 | public function walkConditionalExpression($condExpr) |
| 198 | { |
| 199 | Deprecation::trigger('doctrine/orm', 'https://github.com/doctrine/orm/pull/9551', 'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.', __METHOD__); |
| 200 | foreach ($this->getWalkers() as $walker) { |
| 201 | $walker->walkConditionalExpression($condExpr); |
| 202 | } |
| 203 | } |
| 204 | public function walkConditionalTerm($condTerm) |
| 205 | { |
| 206 | Deprecation::trigger('doctrine/orm', 'https://github.com/doctrine/orm/pull/9551', 'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.', __METHOD__); |
| 207 | foreach ($this->getWalkers() as $walker) { |
| 208 | $walker->walkConditionalTerm($condTerm); |
| 209 | } |
| 210 | } |
| 211 | public function walkConditionalFactor($factor) |
| 212 | { |
| 213 | Deprecation::trigger('doctrine/orm', 'https://github.com/doctrine/orm/pull/9551', 'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.', __METHOD__); |
| 214 | foreach ($this->getWalkers() as $walker) { |
| 215 | $walker->walkConditionalFactor($factor); |
| 216 | } |
| 217 | } |
| 218 | public function walkConditionalPrimary($condPrimary) |
| 219 | { |
| 220 | Deprecation::trigger('doctrine/orm', 'https://github.com/doctrine/orm/pull/9551', 'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.', __METHOD__); |
| 221 | foreach ($this->getWalkers() as $walker) { |
| 222 | $walker->walkConditionalPrimary($condPrimary); |
| 223 | } |
| 224 | } |
| 225 | public function walkExistsExpression($existsExpr) |
| 226 | { |
| 227 | Deprecation::trigger('doctrine/orm', 'https://github.com/doctrine/orm/pull/9551', 'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.', __METHOD__); |
| 228 | foreach ($this->getWalkers() as $walker) { |
| 229 | $walker->walkExistsExpression($existsExpr); |
| 230 | } |
| 231 | } |
| 232 | public function walkCollectionMemberExpression($collMemberExpr) |
| 233 | { |
| 234 | Deprecation::trigger('doctrine/orm', 'https://github.com/doctrine/orm/pull/9551', 'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.', __METHOD__); |
| 235 | foreach ($this->getWalkers() as $walker) { |
| 236 | $walker->walkCollectionMemberExpression($collMemberExpr); |
| 237 | } |
| 238 | } |
| 239 | public function walkEmptyCollectionComparisonExpression($emptyCollCompExpr) |
| 240 | { |
| 241 | Deprecation::trigger('doctrine/orm', 'https://github.com/doctrine/orm/pull/9551', 'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.', __METHOD__); |
| 242 | foreach ($this->getWalkers() as $walker) { |
| 243 | $walker->walkEmptyCollectionComparisonExpression($emptyCollCompExpr); |
| 244 | } |
| 245 | } |
| 246 | public function walkNullComparisonExpression($nullCompExpr) |
| 247 | { |
| 248 | Deprecation::trigger('doctrine/orm', 'https://github.com/doctrine/orm/pull/9551', 'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.', __METHOD__); |
| 249 | foreach ($this->getWalkers() as $walker) { |
| 250 | $walker->walkNullComparisonExpression($nullCompExpr); |
| 251 | } |
| 252 | } |
| 253 | public function walkInExpression($inExpr) |
| 254 | { |
| 255 | Deprecation::trigger('doctrine/orm', 'https://github.com/doctrine/orm/pull/9551', 'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.', __METHOD__); |
| 256 | foreach ($this->getWalkers() as $walker) { |
| 257 | $walker->walkInExpression($inExpr); |
| 258 | } |
| 259 | } |
| 260 | public function walkInstanceOfExpression($instanceOfExpr) |
| 261 | { |
| 262 | Deprecation::trigger('doctrine/orm', 'https://github.com/doctrine/orm/pull/9551', 'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.', __METHOD__); |
| 263 | foreach ($this->getWalkers() as $walker) { |
| 264 | $walker->walkInstanceOfExpression($instanceOfExpr); |
| 265 | } |
| 266 | } |
| 267 | public function walkLiteral($literal) |
| 268 | { |
| 269 | Deprecation::trigger('doctrine/orm', 'https://github.com/doctrine/orm/pull/9551', 'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.', __METHOD__); |
| 270 | foreach ($this->getWalkers() as $walker) { |
| 271 | $walker->walkLiteral($literal); |
| 272 | } |
| 273 | } |
| 274 | public function walkBetweenExpression($betweenExpr) |
| 275 | { |
| 276 | Deprecation::trigger('doctrine/orm', 'https://github.com/doctrine/orm/pull/9551', 'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.', __METHOD__); |
| 277 | foreach ($this->getWalkers() as $walker) { |
| 278 | $walker->walkBetweenExpression($betweenExpr); |
| 279 | } |
| 280 | } |
| 281 | public function walkLikeExpression($likeExpr) |
| 282 | { |
| 283 | Deprecation::trigger('doctrine/orm', 'https://github.com/doctrine/orm/pull/9551', 'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.', __METHOD__); |
| 284 | foreach ($this->getWalkers() as $walker) { |
| 285 | $walker->walkLikeExpression($likeExpr); |
| 286 | } |
| 287 | } |
| 288 | public function walkStateFieldPathExpression($stateFieldPathExpression) |
| 289 | { |
| 290 | Deprecation::trigger('doctrine/orm', 'https://github.com/doctrine/orm/pull/9551', 'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.', __METHOD__); |
| 291 | foreach ($this->getWalkers() as $walker) { |
| 292 | $walker->walkStateFieldPathExpression($stateFieldPathExpression); |
| 293 | } |
| 294 | } |
| 295 | public function walkComparisonExpression($compExpr) |
| 296 | { |
| 297 | Deprecation::trigger('doctrine/orm', 'https://github.com/doctrine/orm/pull/9551', 'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.', __METHOD__); |
| 298 | foreach ($this->getWalkers() as $walker) { |
| 299 | $walker->walkComparisonExpression($compExpr); |
| 300 | } |
| 301 | } |
| 302 | public function walkInputParameter($inputParam) |
| 303 | { |
| 304 | Deprecation::trigger('doctrine/orm', 'https://github.com/doctrine/orm/pull/9551', 'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.', __METHOD__); |
| 305 | foreach ($this->getWalkers() as $walker) { |
| 306 | $walker->walkInputParameter($inputParam); |
| 307 | } |
| 308 | } |
| 309 | public function walkArithmeticExpression($arithmeticExpr) |
| 310 | { |
| 311 | Deprecation::trigger('doctrine/orm', 'https://github.com/doctrine/orm/pull/9551', 'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.', __METHOD__); |
| 312 | foreach ($this->getWalkers() as $walker) { |
| 313 | $walker->walkArithmeticExpression($arithmeticExpr); |
| 314 | } |
| 315 | } |
| 316 | public function walkArithmeticTerm($term) |
| 317 | { |
| 318 | Deprecation::trigger('doctrine/orm', 'https://github.com/doctrine/orm/pull/9551', 'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.', __METHOD__); |
| 319 | foreach ($this->getWalkers() as $walker) { |
| 320 | $walker->walkArithmeticTerm($term); |
| 321 | } |
| 322 | } |
| 323 | public function walkStringPrimary($stringPrimary) |
| 324 | { |
| 325 | Deprecation::trigger('doctrine/orm', 'https://github.com/doctrine/orm/pull/9551', 'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.', __METHOD__); |
| 326 | foreach ($this->getWalkers() as $walker) { |
| 327 | $walker->walkStringPrimary($stringPrimary); |
| 328 | } |
| 329 | } |
| 330 | public function walkArithmeticFactor($factor) |
| 331 | { |
| 332 | Deprecation::trigger('doctrine/orm', 'https://github.com/doctrine/orm/pull/9551', 'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.', __METHOD__); |
| 333 | foreach ($this->getWalkers() as $walker) { |
| 334 | $walker->walkArithmeticFactor($factor); |
| 335 | } |
| 336 | } |
| 337 | public function walkSimpleArithmeticExpression($simpleArithmeticExpr) |
| 338 | { |
| 339 | Deprecation::trigger('doctrine/orm', 'https://github.com/doctrine/orm/pull/9551', 'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.', __METHOD__); |
| 340 | foreach ($this->getWalkers() as $walker) { |
| 341 | $walker->walkSimpleArithmeticExpression($simpleArithmeticExpr); |
| 342 | } |
| 343 | } |
| 344 | public function walkPathExpression($pathExpr) |
| 345 | { |
| 346 | Deprecation::trigger('doctrine/orm', 'https://github.com/doctrine/orm/pull/9551', 'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.', __METHOD__); |
| 347 | foreach ($this->getWalkers() as $walker) { |
| 348 | $walker->walkPathExpression($pathExpr); |
| 349 | } |
| 350 | } |
| 351 | public function walkResultVariable($resultVariable) |
| 352 | { |
| 353 | Deprecation::trigger('doctrine/orm', 'https://github.com/doctrine/orm/pull/9551', 'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.', __METHOD__); |
| 354 | foreach ($this->getWalkers() as $walker) { |
| 355 | $walker->walkResultVariable($resultVariable); |
| 356 | } |
| 357 | } |
| 358 | public function getExecutor($AST) |
| 359 | { |
| 360 | Deprecation::trigger('doctrine/orm', 'https://github.com/doctrine/orm/pull/9551', 'Method "%s" is deprecated and will be removed in ORM 3.0 without replacement.', __METHOD__); |
| 361 | return null; |
| 362 | } |
| 363 | private function getWalkers() : Generator |
| 364 | { |
| 365 | foreach ($this->walkers as $walkerClass) { |
| 366 | (yield new $walkerClass($this->query, $this->parserResult, $this->queryComponents)); |
| 367 | } |
| 368 | } |
| 369 | } |
| 370 |