Add design document for integration with Symfony Command Loader#408
Add design document for integration with Symfony Command Loader#408mattwellss wants to merge 2 commits intomagento:masterfrom
Conversation
|
|
||
| use Symfony\Component\Console\CommandLoader\CommandloaderInterface; | ||
|
|
||
| class MagentoCommandloader implements CommandLoaderInterface |
There was a problem hiding this comment.
I would suggest removing Magento from the class name, as it already a part of the namespace.
|
Thanks for the review, @joni-jones. I'll make that change. A couple questions for you: Regarding InterfacesShould I assume there needs to be a Magento-namespaced interface? For example: namespace Magento\Framework\Console;
interface CommandLoaderInterface extends \Symfony\Component\Console\CommandLoader\CommandLoaderInterface {}I don't believe it would need to define any of its own methods. Everything necessary is already provided by the parent interface. Otherwise, we'll end up with classes directly implementing the Regarding Command InstantiationCommandList classes use both Magento's object manager and the Laminas service manager to intantiate commands:
Because commands are created by two different means, and because Symfony applications can only have a single Command Loader, it follows that we might need to maintain multiple implementations of Command Loaders:
The earliest commit I can find with commands used the Zend service manager: magento/magento2@2f2e4ec#diff-3b4aa36093da63881b26624512aaa8e0R49, so the continuing use of the Laminas version may be an historical artifact, but I'm not certain. Do you know if we need to maintain two separate instantiation paths for Commands? If so, does my delineation of the types of CommandLoaders seem correct? |
This has also been discussed in the Magento application repository: magento/magento2#29266
Problem
Several console commands require significant processing to determine their definitions, reducing the overall performance of Magento's CLI even when they aren't used.
Solution
Integrate
Symfony\Component\Console\CommandLoader\CommandLoaderInterfacewith Magento's CLI application, allowing commands to be added without being instantiated.Requested Reviewers
@joni-jones, @maghamed
Thanks for looking!