8000 feature #22734 [Console] Add support for command lazy-loading (chalasr) · symfony/security-bundle@d3a4feb · GitHub
[go: up one dir, main page]

Skip to content

Commit d3a4feb

Browse files
feature #22734 [Console] Add support for command lazy-loading (chalasr)
This PR was merged into the 3.4 branch. Discussion ---------- [Console] Add support for command lazy-loading | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | symfony/symfony#12063 symfony/symfony#16438 symfony/symfony#13946 #21781 | License | MIT | Doc PR | todo This PR adds command lazy-loading support to the console, based on PSR-11 and DI tags. (symfony/symfony#12063 (comment)) Commands registered as services which set the `command` attribute on their `console.command` tag are now instantiated when calling `Application::get()` instead of all instantiated at `run()`. __Usage__ ```yaml app.command.heavy: tags: - { name: console.command, command: app:heavy } ``` This way private command services can be inlined (no public aliases, remain really private). With console+PSR11 implem only: ```php $application = new Application(); $container = new ServiceLocator(['heavy' => function () { return new Heavy(); }]); $application->setCommandLoader(new ContainerCommandLoader($container, ['app:heavy' => 'heavy']); ``` Implementation is widely inspired from Twig runtime loaders (without the definition/runtime separation which is not needed here). Commits ------- 7f97519 Add support for command lazy-loading
2 parents 4a6bde8 + f9b5b2f commit d3a4feb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Resources/config/console.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<service 5C7B id="security.console.user_password_encoder_command" class="Symfony\Bundle\SecurityBundle\Command\UserPasswordEncoderCommand">
1111
<argument type="service" id="security.encoder_factory"/>
1212
<argument type="collection" /> <!-- encoders' user classes -->
13-
<tag name="console.command" />
13+
<tag name="console.command" command="security:encode-password" />
1414
</service>
1515
</services>
1616
</container>

0 commit comments

Comments
 (0)
0