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

Bad service name on not-autowirable controller #31997

Closed
nicolas-grekas opened this issue Jun 11, 2019 · 1 comment

Comments

Projects
None yet
5 participants
@nicolas-grekas
Copy link
Member

commented Jun 11, 2019

Symfony version(s) affected: 4.3.1

When I type-hint a not-existing type on a controller, I get an error message that contains an id I know nothing about:

Cannot autowire service "debug.argument_resolver.not_tagged_controller.inner": argument "$twig" of method "__construct()" has type "App\Environment" but this class was not found.

This should be this instead:

Cannot autowire service "App\Controller\HelloController": argument "$twig" of method "__construct()" has type "App\Environment" but this class was not found.

@Simperfit

This comment has been minimized.

Copy link
Contributor

commented Jun 14, 2019

I've got that too this morning, fixing it right now.

@fabpot fabpot closed this Jun 16, 2019

fabpot added a commit that referenced this issue Jun 16, 2019

bug #32040 [DI] Show the right class autowired when providing a non-e…
…xisting class (Simperfit)

This PR was merged into the 4.3 branch.

Discussion
----------

[DI] Show the right class autowired when providing a non-existing class

| Q             | A
| ------------- | ---
| Branch?        4.3
| Bug fix?      | yes
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | #31997   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        |none <!-- required for new features -->

<!--
Replace this notice by a short README for your feature/bugfix. This will help people
understand your PR and can be used as a start for the documentation.

Additionally (see https://symfony.com/roadmap):
 - Bug fixes must be submitted against the lowest maintained branch where they apply
   (lowest branches are regularly merged to upper ones so they get the fixes too).
 - Features and deprecations must be submitted against branch 4.4.
 - Legacy code removals go to the master branch.
-->

This gets the last current id before the error and pass it to the callback in order to get the right error message.

Commits
-------

fbda90a [DI] Show the right class autowired when providing a non-existing class in constructor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.