Merge branch 'improvement/#6325-improve-dql-exception-message-for-single-valued-inverse-association-path'
Close #6325
This commit is contained in:
commit
9b9128ae77
@ -19,6 +19,8 @@
|
|||||||
|
|
||||||
namespace Doctrine\ORM\Query;
|
namespace Doctrine\ORM\Query;
|
||||||
|
|
||||||
|
use Doctrine\ORM\Query\AST\PathExpression;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description of QueryException.
|
* Description of QueryException.
|
||||||
*
|
*
|
||||||
@ -204,13 +206,15 @@ class QueryException extends \Doctrine\ORM\ORMException
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param PathExpression $pathExpr
|
||||||
|
*
|
||||||
* @return QueryException
|
* @return QueryException
|
||||||
*/
|
*/
|
||||||
public static function associationPathInverseSideNotSupported()
|
public static function associationPathInverseSideNotSupported(PathExpression $pathExpr)
|
||||||
{
|
{
|
||||||
return new self(
|
return new self(
|
||||||
"A single-valued association path expression to an inverse side is not supported".
|
'A single-valued association path expression to an inverse side is not supported in DQL queries. ' .
|
||||||
" in DQL queries. Use an explicit join instead."
|
'Instead of "' . $pathExpr->identificationVariable . '.' . $pathExpr->field . '" use an explicit join.'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -644,6 +644,7 @@ class SqlWalker implements TreeWalker
|
|||||||
{
|
{
|
||||||
$sql = '';
|
$sql = '';
|
||||||
|
|
||||||
|
/* @var $pathExpr Query\AST\PathExpression */
|
||||||
switch ($pathExpr->type) {
|
switch ($pathExpr->type) {
|
||||||
case AST\PathExpression::TYPE_STATE_FIELD:
|
case AST\PathExpression::TYPE_STATE_FIELD:
|
||||||
$fieldName = $pathExpr->field;
|
$fieldName = $pathExpr->field;
|
||||||
@ -671,7 +672,7 @@ class SqlWalker implements TreeWalker
|
|||||||
$assoc = $class->associationMappings[$fieldName];
|
$assoc = $class->associationMappings[$fieldName];
|
||||||
|
|
||||||
if ( ! $assoc['isOwningSide']) {
|
if ( ! $assoc['isOwningSide']) {
|
||||||
throw QueryException::associationPathInverseSideNotSupported();
|
throw QueryException::associationPathInverseSideNotSupported($pathExpr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// COMPOSITE KEYS NOT (YET?) SUPPORTED
|
// COMPOSITE KEYS NOT (YET?) SUPPORTED
|
||||||
|
Loading…
x
Reference in New Issue
Block a user