-
Notifications
You must be signed in to change notification settings - Fork 54
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
[BC BREAK] Full blown DI for console commands #50
Conversation
…te services. BC BREAK, since this means autowired = true
@@ -24,6 +24,25 @@ The best way to install Kdyby/Console is using [Composer](http://getcomposer.or | |||
$ composer require kdyby/console | |||
``` | |||
|
|||
Then enable the extension in your `config.neon`: |
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.
I don't want this in the readme, it adds work for me to maintain two documents :-/
I disagree about this one. I don't wanna prevent it, but I also don't wanna ecourage it. |
I would like the avoid this discussion entirely and let everybody do it as they like. The |
Also, having them autowired should not cause any applications to break. Is there anything else that can be considered a BC Break? |
So I see multiple stuff being discussed here, let's consolidate.
As far as I understand it, this happens because I used Can be seen here: |
BC break add - OH, I see, injects are called in But that means, if I inject a command into another command using DI, I won't have injects called properly. Maybe it would be cleaner to just remove the |
The construtor injection always worked, you just haven't had the full blown capabilities of configuring the service as in the
to resolve the inject methods/properties is the job of InjectExtension, which must be enabled by the tag. |
Yes, that's right, the "propper" way to invoke the command (if you must) is calling it through application. As there might be more to it's initialization (events, helpers, ...). Or you know... you extract the logic so you don't have to hack it :) |
Sorry, but I don't wanna introduce any more ways of doing the same thing. If you wanna better configuration of command services, just configure them as services and properly tag them. |
Updated the
ConsoleExtension
, so that it usesNette\DI
for parsing individual commands.Therefore, full-blown Nette DI is possible - you can set
inject
andautowire
and all options on every single individual service. However, this is a BC break, because previously all commands were not autowired and were injected instead.This change, alongside with the documentation update, should adhere to nette coding practice of defining all dependencies on constructor level. Even though symfony recommends to use arbitraty
configure
method, using constructor is cleaner design IMHO.edit see this link for new abilities in
config.neon