-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Console] Added support for lazy-loaded commands (with Command resolver) #13989
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
Conversation
a07749f
to
4b2725e
Compare
Hi ! |
852f8ba
to
1b884b7
Compare
46d93eb
to
33b6e0e
Compare
I've added |
acf06c4
to
6c7c91a
Compare
6c7c91a
to
d2acc15
Compare
This PR is ready for review now. |
d2acc15
to
3c82276
Compare
3c82276
to
b08fc46
Compare
* @param CommandResolverInterface $resolver | ||
* @return Command | ||
*/ | ||
final public static function registerLazyLoaded(CommandConfiguration $configuration, CommandResolverInterface $resolver) |
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.
this is not register a command, so the name looks wrong.
Not calling the parent constructor is wrong: it means you don't initialize the class properly, which can leave it in a broken state (leading to fatal errors). And this is a radical change in the way the component works (btw, there are already other console packages splitting entirely the command definition from the command execution in case you prefer such architecture). |
Sure, it's not clear from theoretical point of view at all. It's just workaround. But the root of these problems lies in SRP violation in
Me either. |
This PR is an alternative (well, I treat it more like PoC and I didn't bother to add tests for now) to the #13946. Example of usage:
Note that I didn't call parent constructor in the
GreetCommand
on purpose. Given it's all about commands as services, I don't want to call parent constructor every time.Thoughts?
/cc @mnapoli