-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Console] Add support for SignalableCommandInterface
with invokable commands
#60389
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
b2deac6
to
9767999
Compare
9767999
to
ae770b7
Compare
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.
Some minor CS fixes and GTM, thanks.
I believe there’s another way to keep this working without implementing the interface: https://github.com/symfony/symfony-docs/pull/20932/files#diff-738612fa300cdcb8d044a240dcec7bc9db05a1671f30e3d1b987bbf200037b8c but I might be missing something, could you please confirm? |
@yceruto it should work indeed, but the proposed approach makes sense to me also. |
@yceruto I remember we discussed this at the time and you had some arguments against |
Yes, I'd prefer a single way to do this for invokable command, less variants to document and maintain. |
ae770b7
to
bb97a2a
Compare
@yceruto Just a heads up, |
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 think this very issue/PR shows that this style would be expected to work. It might also make the feature easier to use when the component is used standalone.
I understand the intention of supporting all features used in normal commands, but in standalone usage, the invokable command approach doesn’t work naturally, people need to call explicitly setCode(), name, description, etc. In those cases, you’ll probably extend the |
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.
for the sake of feature parity between invokable and non-invokable commands
My argument was more about why not to deprecate or remove the |
In those standalone cases without an |
If the goal is to simplify support for invokable commands, I suggest keeping this PR as-is with the |
@yceruto If you mean we should not support |
I’m fine with invokable commands not supporting all CLI features out of the box. If extending the Command class is the way to enable them, that’s totally acceptable to me, just like we already do with invokable controllers and AbstractController. I don’t mind extending a class if that’s all it takes to unlock the functionality I need. |
Sure, but why make it more complex than expected? I don't see your point sorry. |
Shortcut methods and unsupported features are different stories. Stop me if I'm wrong but there is no AbstractController feature that cannot be implemented the same way by controllers not extending it |
My goal is to make it simpler for developers, but I’m probably wrong in this case, sorry for the noise and confusion @nicolas-grekas. |
No worries, it's always useful to have a discussion. Here I don't see much added complexity (I see this as simpler actually, on the Command side) so I'm fine with the change. |
Thank you @HypeMC. |
Currently, it's not possible to use the
SignalableCommandInterface
with invokable commands.This PR adds support for that.