Skip to content

Precision about dependency injection resolving #8085

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
wants to merge 1 commit into from
Closed

Precision about dependency injection resolving #8085

wants to merge 1 commit into from

Conversation

JasonBenett
Copy link

The resolving of dependency injection in a Controller action is available if the controller is defined as a service. I think this comportment have to be more explicit in this documentation's part to prevent some user's incomprehension.

The resolving of dependency injection in a Controller action is available if the controller is defined as a service. I think this comportment have to be more explicit in this documentation's part to prevent some user's incomprehension.
@weaverryan
Copy link
Member

I think adding a note like this is a good idea... but we should probably add it in a bunch of different places where we suddenly autowire a controller argument like this (we could remove those notes in a few versions).

For the note, how about:

.. note::

    If you get an error that the `$authUtils` argument is missing, it's probably because you need
    to activate this new feature in Symfony 3.3. See this :ref:`controller service argument note <controller-service-arguments-tag>`.

What do you guys think about the wording? If we like it, we should really repeat this in other places.

@JasonBenett
Copy link
Author

I totally agree with your wording. Less clumsy than mine!
Indeed, we can repeat this one on every page updated to use the autowire.

@@ -157,6 +157,10 @@ Great! Next, add the logic to ``loginAction()`` that displays the login form::
));
}

Please note that the controller autoresolve the AuthenticationUtils injection
only if defined as a service. Since Symfony 3.3, this comportment is adopted
Copy link
Contributor

@OskarStark OskarStark Jul 5, 2017

Choose a reason for hiding this comment

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

maybe behavior sounds more familar then comportment?

Copy link
Author

Choose a reason for hiding this comment

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

@OskarStark yes you're right. My english skills are sometimes a little bit poor ;)
But my sentence should be replaced by the one given by @weaverryan so no problem

@xabbuh
Copy link
Member

xabbuh commented Jul 9, 2017

@JasonBenett Do you think you can make the change Ryan suggested? And possibly also add it in other places where we now make use of the controller being registered as a service.

@javiereguiluz
Copy link
Member

@JasonBenett thanks for this contribution! Sadly, Symfony 3.3 was deprecated before we could merge this ... so I've opened #9235 to merge this in 3.4 branch instead. In any case, thanks for helping us realize that this needed further explanation!

javiereguiluz added a commit that referenced this pull request Feb 9, 2018
This PR was merged into the 3.4 branch.

Discussion
----------

Added a note about controller arguments

This finishes #8085.

Commits
-------

9075771 Added a note about controller arguments
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.

7 participants