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
QueryException.php
106 lines
| 1 | <?php |
| 2 | declare (strict_types=1); |
| 3 | namespace MailPoetVendor\Doctrine\ORM\Query; |
| 4 | if (!defined('ABSPATH')) exit; |
| 5 | use MailPoetVendor\Doctrine\ORM\Exception\ORMException; |
| 6 | use MailPoetVendor\Doctrine\ORM\Mapping\ClassMetadata; |
| 7 | use MailPoetVendor\Doctrine\ORM\Query\AST\PathExpression; |
| 8 | use Exception; |
| 9 | use Stringable; |
| 10 | class QueryException extends ORMException |
| 11 | { |
| 12 | public static function dqlError($dql) |
| 13 | { |
| 14 | return new self($dql); |
| 15 | } |
| 16 | public static function syntaxError($message, $previous = null) |
| 17 | { |
| 18 | return new self('[Syntax Error] ' . $message, 0, $previous); |
| 19 | } |
| 20 | public static function semanticalError($message, $previous = null) |
| 21 | { |
| 22 | return new self('[Semantical Error] ' . $message, 0, $previous); |
| 23 | } |
| 24 | public static function invalidLockMode() |
| 25 | { |
| 26 | return new self('Invalid lock mode hint provided.'); |
| 27 | } |
| 28 | public static function invalidParameterType($expected, $received) |
| 29 | { |
| 30 | return new self('Invalid parameter type, ' . $received . ' given, but ' . $expected . ' expected.'); |
| 31 | } |
| 32 | public static function invalidParameterPosition($pos) |
| 33 | { |
| 34 | return new self('Invalid parameter position: ' . $pos); |
| 35 | } |
| 36 | public static function tooManyParameters($expected, $received) |
| 37 | { |
| 38 | return new self('Too many parameters: the query defines ' . $expected . ' parameters and you bound ' . $received); |
| 39 | } |
| 40 | public static function tooFewParameters($expected, $received) |
| 41 | { |
| 42 | return new self('Too few parameters: the query defines ' . $expected . ' parameters but you only bound ' . $received); |
| 43 | } |
| 44 | public static function invalidParameterFormat($value) |
| 45 | { |
| 46 | return new self('Invalid parameter format, ' . $value . ' given, but :<name> or ?<num> expected.'); |
| 47 | } |
| 48 | public static function unknownParameter($key) |
| 49 | { |
| 50 | return new self('Invalid parameter: token ' . $key . ' is not defined in the query.'); |
| 51 | } |
| 52 | public static function parameterTypeMismatch() |
| 53 | { |
| 54 | return new self('DQL Query parameter and type numbers mismatch, but have to be exactly equal.'); |
| 55 | } |
| 56 | public static function invalidPathExpression($pathExpr) |
| 57 | { |
| 58 | return new self("Invalid PathExpression '" . $pathExpr->identificationVariable . '.' . $pathExpr->field . "'."); |
| 59 | } |
| 60 | public static function invalidLiteral($literal) |
| 61 | { |
| 62 | return new self("Invalid literal '" . $literal . "'"); |
| 63 | } |
| 64 | public static function iterateWithFetchJoinCollectionNotAllowed($assoc) |
| 65 | { |
| 66 | return new self('Invalid query operation: Not allowed to iterate over fetch join collections ' . 'in class ' . $assoc['sourceEntity'] . ' association ' . $assoc['fieldName']); |
| 67 | } |
| 68 | public static function partialObjectsAreDangerous() |
| 69 | { |
| 70 | return new self('Loading partial objects is dangerous. Fetch full objects or consider ' . 'using a different fetch mode. If you really want partial objects, ' . 'set the doctrine.forcePartialLoad query hint to TRUE.'); |
| 71 | } |
| 72 | public static function overwritingJoinConditionsNotYetSupported($assoc) |
| 73 | { |
| 74 | return new self('Unsupported query operation: It is not yet possible to overwrite the join ' . 'conditions in class ' . $assoc['sourceEntityName'] . ' association ' . $assoc['fieldName'] . '. ' . 'Use WITH to append additional join conditions to the association.'); |
| 75 | } |
| 76 | public static function associationPathInverseSideNotSupported(PathExpression $pathExpr) |
| 77 | { |
| 78 | return new self('A single-valued association path expression to an inverse side is not supported in DQL queries. ' . 'Instead of "' . $pathExpr->identificationVariable . '.' . $pathExpr->field . '" use an explicit join.'); |
| 79 | } |
| 80 | public static function iterateWithFetchJoinNotAllowed($assoc) |
| 81 | { |
| 82 | return new self('Iterate with fetch join in class ' . $assoc['sourceEntity'] . ' using association ' . $assoc['fieldName'] . ' not allowed.'); |
| 83 | } |
| 84 | public static function eagerFetchJoinWithNotAllowed(string $sourceEntity, string $fieldName) : QueryException |
| 85 | { |
| 86 | return new self('Associations with fetch-mode=EAGER may not be using WITH conditions in |
| 87 | "' . $sourceEntity . '#' . $fieldName . '".'); |
| 88 | } |
| 89 | public static function iterateWithMixedResultNotAllowed() : QueryException |
| 90 | { |
| 91 | return new self('Iterating a query with mixed results (using scalars) is not supported.'); |
| 92 | } |
| 93 | public static function associationPathCompositeKeyNotSupported() |
| 94 | { |
| 95 | return new self('A single-valued association path expression to an entity with a composite primary ' . 'key is not supported. Explicitly name the components of the composite primary key ' . 'in the query.'); |
| 96 | } |
| 97 | public static function instanceOfUnrelatedClass($className, $rootClass) |
| 98 | { |
| 99 | return new self("Cannot check if a child of '" . $rootClass . "' is instanceof '" . $className . "', " . 'inheritance hierarchy does not exists between these two classes.'); |
| 100 | } |
| 101 | public static function invalidQueryComponent($dqlAlias) |
| 102 | { |
| 103 | return new self("Invalid query component given for DQL alias '" . $dqlAlias . "', " . "requires 'metadata', 'parent', 'relation', 'map', 'nestingLevel' and 'token' keys."); |
| 104 | } |
| 105 | } |
| 106 |