Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve exception message for DQL single-valued association path expression to an inverse side (unsupported) #6325

Closed
wants to merge 1 commit into from

Conversation

Isinlor
Copy link
Contributor

@Isinlor Isinlor commented Mar 6, 2017

Hello,
I have added path expression to the exception about single-valued association to an inverse side being not supported. The path expression makes it easier to identify the issue among many other expression in potentially complex query.

Seems like many people had an issue with this exception.

For a query:

SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.address IN (?1, ?2)

The exception message before:

A single-valued association path expression to an inverse side is not supported in DQL queries. Use an explicit join instead.

The exception message after:

A single-valued association path expression to an inverse side is not supported in DQL queries. Instead of 'u.address' use an explicit join.

Copy link
Member

@lcobucci lcobucci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even though it's a very tiny BC break it LGTM. @Ocramius should we document this in the v2.6 changelog?

@lcobucci lcobucci self-assigned this Mar 6, 2017
@lcobucci lcobucci added this to the 2.6.0 milestone Mar 6, 2017
@lcobucci lcobucci assigned Ocramius and unassigned lcobucci Mar 6, 2017
Copy link
Member

@Ocramius Ocramius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM besides nitpicking. As @lcobucci mentioned, we need an entry in UPGRADE.md for this, since it still counts as BC Break.

* @return QueryException
*/
public static function associationPathInverseSideNotSupported()
public static function associationPathInverseSideNotSupported($pathExpr)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know the caller side uses abbreviations, but please don't abbreviate here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was following this example. Are you fine with the inconsistency?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you can add it to the patch, could also rename the variable there please? 👍

@@ -204,13 +204,15 @@ public static function overwritingJoinConditionsNotYetSupported($assoc)
}

/**
* @param object $pathExpr
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there really nothing more detailed than object? :| Sounds like the SqlWalker internal API could need a DTO

@Ocramius
Copy link
Member

And yep, a test for the static method is needed :-\

@Ocramius Ocramius changed the title Improve exception message (quick to review) Improve exception message for DQL single-valued association path expression to an inverse side (unsupported) Jun 21, 2017
Ocramius added a commit that referenced this pull request Jun 21, 2017
@Ocramius Ocramius closed this in 9b9128a Jun 21, 2017
@Ocramius
Copy link
Member

@Isinlor I manually applied the patch after a rebase and some minor fixes: see 9b9128a

Thanks!

Ocramius added a commit that referenced this pull request Jun 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants