Skip to content

Support for Symfony's CommandLoaderInterface in Magento CLI #29266

@mattwellss

Description

@mattwellss

Description (*)

Magento applications come out of the box with a few particularly "heavy to initialize" CLI commands. Two examples: \Magento\Setup\Console\Command\InstallCommand and \Magento\Setup\Console\Command\ConfigSetCommand. Each of these probes all installed modules for ConfigOptionsList classes, initializes them, and reads options from them. That work is not necessary unless the user is interacting with either these commands, though it's currently necessary due to the fact that each command added directly to a Symfony Console app must have a Definition.

Expected behavior (*)

Without going too far into designing the implementation, I'd like to see an alternative to the \Magento\Framework\Console\CommandListInterface which defines a return value similar to that of the \Symfony\Component\Console\CommandLoader\CommandLoaderInterface. I'd additionally like to see Magento implement this alternative Command loading technique especially for time-consuming commands such as those listed in the description.

Benefits

Currently, a command must be "fully initialized" to be ready to add to Magento. This means it must be instantiated at runtime, along with its dependencies, definition, etc. In order to minimize the impact of new commands, extra care must be taken to use factories and proxies in dependencies.

If new commands can be added to Magento's CLI app without being fully initialized, implementors can be free to focus on the features.

Additional information

If this is a desired change, I'd be happy to request time from my employer to implement it and contribute it to the community. Thanks for considering it!

Metadata

Metadata

Assignees

Labels

Area: PerformanceComponent: AppComponent: BackendComponent: ConsoleComponent: SetupIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedPriority: P2A defect with this priority could have functionality issues which are not to expectations.Progress: doneReported on 2.4.xIndicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchSeverity: S1Affects critical data or functionality and forces users to employ a workaround.feature request

Type

No type

Projects

Status

Pull Request in Progress

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions