-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[Console] Command as service #3621
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
Changes from 1 commit
947ad92
a055140
a7b916e
cdd534a
e137951
6a7a25f
11bfe50
e8b3320
c8fe610
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,7 +75,7 @@ By default, Symfony will take a look in the ``Command`` directory of you | |
bundles and automatically register your commands. For the ones implementing | ||
the ``ContainerAwareCommand`` interface, Symfony will even inject the container. | ||
|
||
If you wan to, you can instead register them as services in the container using | ||
If you want to, you can instead register them as services in the container using | ||
the ``console.command`` tag: | ||
|
||
.. configuration-block:: | ||
|
@@ -115,11 +115,12 @@ the ``console.command`` tag: | |
.. tip:: | ||
|
||
Command as a service can be usefull in few situations: | ||
* if you need your commands to be defined somewhere else than ``Command`` | ||
* if you need to access services or configuration parameters in the | ||
``configure`` method | ||
|
||
For example, Imagine you want to provide a default value for the ``name`` | ||
* If you need your commands to be defined somewhere else than ``Command``; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. than in the? ... folder There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lower the case at the start to be consistent with the second sentence below |
||
* if you need to access services or configuration parameters in the | ||
``configure`` method. | ||
|
||
For example, imagine you want to provide a default value for the ``name`` | ||
option. You could hard code a string and pass it as the 4th argument of | ||
``addArgument``, or you could allow the user to set the default value in the | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in their There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. -1 "the configuration" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should I change user to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wauter was saying that he is -1 about "the configuration" check my comment and also if you use user then use her configuration, although some genre There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @cordoval I was saying that I'm -1 for your change. "The configuration" is correct. (or at least, I tried to say that...)
Sadly, this isn't your documentation and we changed our standards to be gender agnostic. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @gnugat to summarize: It's all perfect :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @wouterj Good :) . There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @gnugat i know that, that is why i said the above 👶 |
||
configuration. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
usefull -> useful
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe even use the plural,
commands as services
, maybe even mention that is a best practiceThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
commands as services isn't a best practise imo. The currently Console implementation lacks of a good support for it, it should only be used in specific cases. That's why this addition is so nice, it tells you a specific case to use it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wouterj Precisely.
@cordoval You might be right about the plural, if we take a look at controllers, we can find the cookbook How to define Controllers as Services