Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Make failed entity argument resolving display a usefull error message #60111

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

Closed
nicolas-grekas opened this issue Apr 1, 2025 · 2 comments · Fixed by #60112
Closed

Make failed entity argument resolving display a usefull error message #60111

nicolas-grekas opened this issue Apr 1, 2025 · 2 comments · Fixed by #60112
Labels
Help wanted Issues and PRs which are looking for volunteers to complete them.

Comments

@nicolas-grekas
Copy link
Member

nicolas-grekas commented Apr 1, 2025

Description

Current, using the default recipe coming with Symfony 7.2, when one has a controller like that:

    #[Route('/conference/{slug}', name: 'conference')]
    public function show(Conference $conference) {

One will get this message:

Image

When you know the solution, the fix is trivial:

-    #[Route('/conference/{slug}', name: 'conference')]
+    #[Route('/conference/{slug:conference}', name: 'conference')]

But when you don't, you're SOL.

The thing is, we do have the reporting infrastructure to improve this: NearMissValueResolverException as introduced in #54107.
It'd be great to leverage it for similar cases.

Help wanted.

Example

No response

@nicolas-grekas nicolas-grekas added the Help wanted Issues and PRs which are looking for volunteers to complete them. label Apr 1, 2025
@MatTheCat
Copy link
Contributor

MatTheCat commented Apr 1, 2025

This would require to replace this return by a NearMissValueResolverException right?

What would a good message look like? Thought of

Cannot find a "%entityClass%"; did you forget to map route parameters to its properties?

@nicolas-grekas
Copy link
Member Author

I think we can take inspiration from the deprecation message, it looks like it hints the same concept.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Help wanted Issues and PRs which are looking for volunteers to complete them.
Projects
None yet
2 participants