-
-
Notifications
You must be signed in to change notification settings - Fork 441
[make:command] Update command generation to support invokables and interactively ask for arguments and options #1750
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
base: 1.x
Are you sure you want to change the base?
Conversation
7b84a0b to
1fad20c
Compare
Move the "Old" Inheritance based command template to a separate template file
…rameters would break generation
1fad20c to
c9a1842
Compare
|
The only two faliing CI checks are seemingly not due to any changes made in this PR. |
|
Wouldn't it be more better to call the templates "InheritanceCommand" and "InvokableCommand" instead of just "Command"? Making it more clear, what the difference is. |
|
just a related idea: if the list of arguments and options is long (more than two or three?) the maker could apply the |
@seizan8 That's a very good suggestion, Thank you! I've updated it |
@yceruto that would be a great addition, I'm currently working on bringing the Symfony 7.4 changes into the command. I wouldn't automatically swap it over to a DTO if the arguments exceed 2 or 3 but keep the choice with the user and prompt them to ask if they wish to place the input in a DTO instead. Don't know if this is something you would agree on? |
This PR introduces support for generating Invokable Commands and interactively will ask to provide options and arguments for the command just as the make:entity would. Currently it is supporting the Symfony 7.3 specification of functionalities.
If the kernel version is below 7.3 it will hide any invokable functionality. If the Kernel version supports invokable commands it will swap over to the invokable system. A user can use --no-invokable to revert back to the inheritance based command.
I see that the invokable generation is duplicated by PR #1746, I'll keep this PR open to support interactivity in generating the command in it's entirety
Some screenshots of the generation process:

Which would in turn generate a command looking like:
