[FrameworkBundle] Move console configuration to PHP

This commit is contained in:
Ahmed Raafat 2020-06-11 15:02:25 +02:00
parent 124c139c39
commit ef01839225
3 changed files with 291 additions and 234 deletions

View File

@ -185,7 +185,7 @@ class FrameworkExtension extends Extension
$container->registerAliasForArgument('parameter_bag', PsrContainerInterface::class);
if (class_exists(Application::class)) {
$loader->load('console.xml');
$phpLoader->load('console.php');
if (!class_exists(BaseXliffLintCommand::class)) {
$container->removeDefinition('console.command.xliff_lint');

View File

@ -0,0 +1,290 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
use Symfony\Bundle\FrameworkBundle\Command\AboutCommand;
use Symfony\Bundle\FrameworkBundle\Command\AssetsInstallCommand;
use Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand;
use Symfony\Bundle\FrameworkBundle\Command\CachePoolClearCommand;
use Symfony\Bundle\FrameworkBundle\Command\CachePoolDeleteCommand;
use Symfony\Bundle\FrameworkBundle\Command\CachePoolListCommand;
use Symfony\Bundle\FrameworkBundle\Command\CachePoolPruneCommand;
use Symfony\Bundle\FrameworkBundle\Command\CacheWarmupCommand;
use Symfony\Bundle\FrameworkBundle\Command\ConfigDebugCommand;
use Symfony\Bundle\FrameworkBundle\Command\ConfigDumpReferenceCommand;
use Symfony\Bundle\FrameworkBundle\Command\ContainerDebugCommand;
use Symfony\Bundle\FrameworkBundle\Command\ContainerLintCommand;
use Symfony\Bundle\FrameworkBundle\Command\DebugAutowiringCommand;
use Symfony\Bundle\FrameworkBundle\Command\EventDispatcherDebugCommand;
use Symfony\Bundle\FrameworkBundle\Command\RouterDebugCommand;
use Symfony\Bundle\FrameworkBundle\Command\RouterMatchCommand;
use Symfony\Bundle\FrameworkBundle\Command\SecretsDecryptToLocalCommand;
use Symfony\Bundle\FrameworkBundle\Command\SecretsEncryptFromLocalCommand;
use Symfony\Bundle\FrameworkBundle\Command\SecretsGenerateKeysCommand;
use Symfony\Bundle\FrameworkBundle\Command\SecretsListCommand;
use Symfony\Bundle\FrameworkBundle\Command\SecretsRemoveCommand;
use Symfony\Bundle\FrameworkBundle\Command\SecretsSetCommand;
use Symfony\Bundle\FrameworkBundle\Command\TranslationDebugCommand;
use Symfony\Bundle\FrameworkBundle\Command\TranslationUpdateCommand;
use Symfony\Bundle\FrameworkBundle\Command\WorkflowDumpCommand;
use Symfony\Bundle\FrameworkBundle\Command\YamlLintCommand;
use Symfony\Bundle\FrameworkBundle\EventListener\SuggestMissingPackageSubscriber;
use Symfony\Component\Console\EventListener\ErrorListener;
use Symfony\Component\Messenger\Command\ConsumeMessagesCommand;
use Symfony\Component\Messenger\Command\DebugCommand;
use Symfony\Component\Messenger\Command\FailedMessagesRemoveCommand;
use Symfony\Component\Messenger\Command\FailedMessagesRetryCommand;
use Symfony\Component\Messenger\Command\FailedMessagesShowCommand;
use Symfony\Component\Messenger\Command\SetupTransportsCommand;
use Symfony\Component\Messenger\Command\StopWorkersCommand;
use Symfony\Component\Translation\Command\XliffLintCommand;
return static function (ContainerConfigurator $container) {
$container->services()
->set('console.error_listener', ErrorListener::class)
->args([
service('logger')->nullOnInvalid(),
])
->tag('kernel.event_subscriber')
->tag('monolog.logger', ['channel' => 'console'])
->set('console.suggest_missing_package_subscriber', SuggestMissingPackageSubscriber::class)
->tag('kernel.event_subscriber')
->set('console.command.about', AboutCommand::class)
->tag('console.command', ['command' => 'about'])
->set('console.command.assets_install', AssetsInstallCommand::class)
->args([
service('filesystem'),
param('kernel.project_dir'),
])
->tag('console.command', ['command' => 'assets:install'])
->set('console.command.cache_clear', CacheClearCommand::class)
->args([
service('cache_clearer'),
service('filesystem'),
])
->tag('console.command', ['command' => 'cache:clear'])
->set('console.command.cache_pool_clear', CachePoolClearCommand::class)
->args([
service('cache.global_clearer'),
])
->tag('console.command', ['command' => 'cache:pool:clear'])
->set('console.command.cache_pool_prune', CachePoolPruneCommand::class)
->args([
[],
])
->tag('console.command', ['command' => 'cache:pool:prune'])
->set('console.command.cache_pool_delete', CachePoolDeleteCommand::class)
->args([
service('cache.global_clearer'),
])
->tag('console.command', ['command' => 'cache:pool:delete'])
->set('console.command.cache_pool_list', CachePoolListCommand::class)
->args([
null,
])
->tag('console.command', ['command' => 'cache:pool:list'])
->set('console.command.cache_warmup', CacheWarmupCommand::class)
->args([
service('cache_warmer'),
])
->tag('console.command', ['command' => 'cache:warmup'])
->set('console.command.config_debug', ConfigDebugCommand::class)
->tag('console.command', ['command' => 'debug:config'])
->set('console.command.config_dump_reference', ConfigDumpReferenceCommand::class)
->tag('console.command', ['command' => 'config:dump-reference'])
->set('console.command.container_debug', ContainerDebugCommand::class)
->tag('console.command', ['command' => 'debug:container'])
->set('console.command.container_lint', ContainerLintCommand::class)
->tag('console.command', ['command' => 'lint:container'])
->set('console.command.debug_autowiring', DebugAutowiringCommand::class)
->args([
null,
service('debug.file_link_formatter')->nullOnInvalid(),
])
->tag('console.command', ['command' => 'debug:autowiring'])
->set('console.command.event_dispatcher_debug', EventDispatcherDebugCommand::class)
->args([
service('event_dispatcher'),
])
->tag('console.command', ['command' => 'debug:event-dispatcher'])
->set('console.command.messenger_consume_messages', ConsumeMessagesCommand::class)
->args([
abstract_arg('Routable message bus'),
service('messenger.receiver_locator'),
service('event_dispatcher'),
service('logger')->nullOnInvalid(),
[], // Receiver names
])
->tag('console.command', ['command' => 'messenger:consume'])
->tag('monolog.logger', ['channel' => 'messenger'])
->set('console.command.messenger_setup_transports', SetupTransportsCommand::class)
->args([
service('messenger.receiver_locator'),
[], // Receiver names
])
->tag('console.command', ['command' => 'messenger:setup-transports'])
->set('console.command.messenger_debug', DebugCommand::class)
->args([
[], // Message to handlers mapping
])
->tag('console.command', ['command' => 'debug:messenger'])
->set('console.command.messenger_stop_workers', StopWorkersCommand::class)
->args([
service('cache.messenger.restart_workers_signal'),
])
->tag('console.command', ['command' => 'messenger:stop-workers'])
->set('console.command.messenger_failed_messages_retry', FailedMessagesRetryCommand::class)
->args([
abstract_arg('Receiver name'),
abstract_arg('Receiver'),
service('messenger.routable_message_bus'),
service('event_dispatcher'),
service('logger'),
])
->tag('console.command', ['command' => 'messenger:failed:retry'])
->set('console.command.messenger_failed_messages_show', FailedMessagesShowCommand::class)
->args([
abstract_arg('Receiver name'),
abstract_arg('Receiver'),
])
->tag('console.command', ['command' => 'messenger:failed:show'])
->set('console.command.messenger_failed_messages_remove', FailedMessagesRemoveCommand::class)
->args([
abstract_arg('Receiver name'),
abstract_arg('Receiver'),
])
->tag('console.command', ['command' => 'messenger:failed:remove'])
->set('console.command.router_debug', RouterDebugCommand::class)
->args([
service('router'),
service('debug.file_link_formatter')->nullOnInvalid(),
])
->tag('console.command', ['command' => 'debug:router'])
->set('console.command.router_match', RouterMatchCommand::class)
->args([
service('router'),
tagged_iterator('routing.expression_language_provider'),
])
->tag('console.command', ['command' => 'router:match'])
->set('console.command.translation_debug', TranslationDebugCommand::class)
->args([
service('translator'),
service('translation.reader'),
service('translation.extractor'),
param('translator.default_path'),
null, // twig.default_path
[], // Translator paths
[], // Twig paths
])
->tag('console.command', ['command' => 'debug:translation'])
->set('console.command.translation_update', TranslationUpdateCommand::class)
->args([
service('translation.writer'),
service('translation.reader'),
service('translation.extractor'),
param('kernel.default_locale'),
param('translator.default_path'),
null, // twig.default_path
[], // Translator paths
[], // Twig paths
])
->tag('console.command', ['command' => 'translation:update'])
->set('console.command.workflow_dump', WorkflowDumpCommand::class)
->tag('console.command', ['command' => 'workflow:dump'])
->set('console.command.xliff_lint', XliffLintCommand::class)
->tag('console.command', ['command' => 'lint:xliff'])
->set('console.command.yaml_lint', YamlLintCommand::class)
->tag('console.command', ['command' => 'lint:yaml'])
->set('console.command.form_debug', \Symfony\Component\Form\Command\DebugCommand::class)
->args([
service('form.registry'),
[], // All form types namespaces are stored here by FormPass
[], // All services form types are stored here by FormPass
[], // All type extensions are stored here by FormPass
[], // All type guessers are stored here by FormPass
service('debug.file_link_formatter')->nullOnInvalid(),
])
->tag('console.command', ['command' => 'debug:form'])
->set('console.command.secrets_set', SecretsSetCommand::class)
->args([
service('secrets.vault'),
service('secrets.local_vault')->nullOnInvalid(),
])
->tag('console.command', ['command' => 'secrets:set'])
->set('console.command.secrets_remove', SecretsRemoveCommand::class)
->args([
service('secrets.vault'),
service('secrets.local_vault')->nullOnInvalid(),
])
->tag('console.command', ['command' => 'secrets:remove'])
->set('console.command.secrets_generate_key', SecretsGenerateKeysCommand::class)
->args([
service('secrets.vault'),
service('secrets.local_vault')->ignoreOnInvalid(),
])
->tag('console.command', ['command' => 'secrets:generate-keys'])
->set('console.command.secrets_list', SecretsListCommand::class)
->args([
service('secrets.vault'),
service('secrets.local_vault'),
])
->tag('console.command', ['command' => 'secrets:list'])
->set('console.command.secrets_decrypt_to_local', SecretsDecryptToLocalCommand::class)
->args([
service('secrets.vault'),
service('secrets.local_vault')->ignoreOnInvalid(),
])
->tag('console.command', ['command' => 'secrets:decrypt-to-local'])
->set('console.command.secrets_encrypt_from_local', SecretsEncryptFromLocalCommand::class)
->args([
service('secrets.vault'),
service('secrets.local_vault'),
])
->tag('console.command', ['command' => 'secrets:encrypt-from-local'])
;
};

View File

@ -1,233 +0,0 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<defaults public="false" />
<service id="console.error_listener" class="Symfony\Component\Console\EventListener\ErrorListener">
<argument type="service" id="logger" on-invalid="null" />
<tag name="kernel.event_subscriber" />
<tag name="monolog.logger" channel="console" />
</service>
<service id="console.suggest_missing_package_subscriber" class="Symfony\Bundle\FrameworkBundle\EventListener\SuggestMissingPackageSubscriber">
<tag name="kernel.event_subscriber" />
</service>
<service id="console.command.about" class="Symfony\Bundle\FrameworkBundle\Command\AboutCommand">
<tag name="console.command" command="about" />
</service>
<service id="console.command.assets_install" class="Symfony\Bundle\FrameworkBundle\Command\AssetsInstallCommand">
<argument type="service" id="filesystem" />
<argument>%kernel.project_dir%</argument>
<tag name="console.command" command="assets:install" />
</service>
<service id="console.command.cache_clear" class="Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand">
<argument type="service" id="cache_clearer" />
<argument type="service" id="filesystem" />
<tag name="console.command" command="cache:clear" />
</service>
<service id="console.command.cache_pool_clear" class="Symfony\Bundle\FrameworkBundle\Command\CachePoolClearCommand">
<argument type="service" id="cache.global_clearer" />
<tag name="console.command" command="cache:pool:clear" />
</service>
<service id="console.command.cache_pool_prune" class="Symfony\Bundle\FrameworkBundle\Command\CachePoolPruneCommand">
<argument type="iterator" />
<tag name="console.command" command="cache:pool:prune" />
</service>
<service id="console.command.cache_pool_delete" class="Symfony\Bundle\FrameworkBundle\Command\CachePoolDeleteCommand">
<argument type="service" id="cache.global_clearer" />
<tag name="console.command" command="cache:pool:delete" />
</service>
<service id="console.command.cache_pool_list" class="Symfony\Bundle\FrameworkBundle\Command\CachePoolListCommand">
<argument /> <!-- Pool names -->
<tag name="console.command" command="cache:pool:list" />
</service>
<service id="console.command.cache_warmup" class="Symfony\Bundle\FrameworkBundle\Command\CacheWarmupCommand">
<argument type="service" id="cache_warmer" />
<tag name="console.command" command="cache:warmup" />
</service>
<service id="console.command.config_debug" class="Symfony\Bundle\FrameworkBundle\Command\ConfigDebugCommand">
<tag name="console.command" command="debug:config" />
</service>
<service id="console.command.config_dump_reference" class="Symfony\Bundle\FrameworkBundle\Command\ConfigDumpReferenceCommand">
<tag name="console.command" command="config:dump-reference" />
</service>
<service id="console.command.container_debug" class="Symfony\Bundle\FrameworkBundle\Command\ContainerDebugCommand">
<tag name="console.command" command="debug:container" />
</service>
<service id="console.command.container_lint" class="Symfony\Bundle\FrameworkBundle\Command\ContainerLintCommand">
<tag name="console.command" command="lint:container" />
</service>
<service id="console.command.debug_autowiring" class="Symfony\Bundle\FrameworkBundle\Command\DebugAutowiringCommand">
<argument>null</argument>
<argument type="service" id="debug.file_link_formatter" on-invalid="null"/>
<tag name="console.command" command="debug:autowiring" />
</service>
<service id="console.command.event_dispatcher_debug" class="Symfony\Bundle\FrameworkBundle\Command\EventDispatcherDebugCommand">
<argument type="service" id="event_dispatcher" />
<tag name="console.command" command="debug:event-dispatcher" />
</service>
<service id="console.command.messenger_consume_messages" class="Symfony\Component\Messenger\Command\ConsumeMessagesCommand">
<argument /> <!-- Routable message bus -->
<argument type="service" id="messenger.receiver_locator" />
<argument type="service" id="event_dispatcher" />
<argument type="service" id="logger" on-invalid="null" />
<argument type="collection" /> <!-- Receiver names -->
<tag name="console.command" command="messenger:consume" />
<tag name="monolog.logger" channel="messenger" />
</service>
<service id="console.command.messenger_setup_transports" class="Symfony\Component\Messenger\Command\SetupTransportsCommand">
<argument type="service" id="messenger.receiver_locator" />
<argument type="collection" /> <!-- Receiver names -->
<tag name="console.command" command="messenger:setup-transports" />
</service>
<service id="console.command.messenger_debug" class="Symfony\Component\Messenger\Command\DebugCommand">
<argument type="collection" /> <!-- Message to handlers mapping -->
<tag name="console.command" command="debug:messenger" />
</service>
<service id="console.command.messenger_stop_workers" class="Symfony\Component\Messenger\Command\StopWorkersCommand">
<argument type="service" id="cache.messenger.restart_workers_signal" />
<tag name="console.command" command="messenger:stop-workers" />
</service>
<service id="console.command.messenger_failed_messages_retry" class="Symfony\Component\Messenger\Command\FailedMessagesRetryCommand">
<argument /> <!-- Receiver name -->
<argument /> <!-- Receiver -->
<argument type="service" id="messenger.routable_message_bus" />
<argument type="service" id="event_dispatcher" />
<argument type="service" id="logger" />
<tag name="console.command" command="messenger:failed:retry" />
</service>
<service id="console.command.messenger_failed_messages_show" class="Symfony\Component\Messenger\Command\FailedMessagesShowCommand">
<argument /> <!-- Receiver name -->
<argument /> <!-- Receiver -->
<tag name="console.command" command="messenger:failed:show" />
</service>
<service id="console.command.messenger_failed_messages_remove" class="Symfony\Component\Messenger\Command\FailedMessagesRemoveCommand">
<argument /> <!-- Receiver name -->
<argument /> <!-- Receiver -->
<tag name="console.command" command="messenger:failed:remove" />
</service>
<service id="console.command.router_debug" class="Symfony\Bundle\FrameworkBundle\Command\RouterDebugCommand">
<argument type="service" id="router" />
<argument type="service" id="debug.file_link_formatter" on-invalid="null" />
<tag name="console.command" command="debug:router" />
</service>
<service id="console.command.router_match" class="Symfony\Bundle\FrameworkBundle\Command\RouterMatchCommand">
<argument type="service" id="router" />
<argument type="tagged_iterator" tag="routing.expression_language_provider" />
<tag name="console.command" command="router:match" />
</service>
<service id="console.command.translation_debug" class="Symfony\Bundle\FrameworkBundle\Command\TranslationDebugCommand">
<argument type="service" id="translator" />
<argument type="service" id="translation.reader" />
<argument type="service" id="translation.extractor" />
<argument>%translator.default_path%</argument>
<argument /> <!-- %twig.default_path% -->
<argument type="collection" /> <!-- Translator paths -->
<argument type="collection" /> <!-- Twig paths -->
<tag name="console.command" command="debug:translation" />
</service>
<service id="console.command.translation_update" class="Symfony\Bundle\FrameworkBundle\Command\TranslationUpdateCommand">
<argument type="service" id="translation.writer" />
<argument type="service" id="translation.reader" />
<argument type="service" id="translation.extractor" />
<argument>%kernel.default_locale%</argument>
<argument>%translator.default_path%</argument>
<argument /> <!-- %twig.default_path% -->
<argument type="collection" /> <!-- Translator paths -->
<argument type="collection" /> <!-- Twig paths -->
<tag name="console.command" command="translation:update" />
</service>
<service id="console.command.workflow_dump" class="Symfony\Bundle\FrameworkBundle\Command\WorkflowDumpCommand">
<tag name="console.command" command="workflow:dump" />
</service>
<service id="console.command.xliff_lint" class="Symfony\Bundle\FrameworkBundle\Command\XliffLintCommand">
<tag name="console.command" command="lint:xliff" />
</service>
<service id="console.command.yaml_lint" class="Symfony\Bundle\FrameworkBundle\Command\YamlLintCommand">
<tag name="console.command" command="lint:yaml" />
</service>
<service id="console.command.form_debug" class="Symfony\Component\Form\Command\DebugCommand">
<argument type="service" id="form.registry" />
<argument type="collection" /> <!-- All form types namespaces are stored here by FormPass -->
<argument type="collection" /> <!-- All services form types are stored here by FormPass -->
<argument type="collection" /> <!-- All type extensions are stored here by FormPass -->
<argument type="collection" /> <!-- All type guessers are stored here by FormPass -->
<argument type="service" id="debug.file_link_formatter" on-invalid="null" />
<tag name="console.command" command="debug:form" />
</service>
<service id="console.command.secrets_set" class="Symfony\Bundle\FrameworkBundle\Command\SecretsSetCommand">
<argument type="service" id="secrets.vault" />
<argument type="service" id="secrets.local_vault" on-invalid="ignore" />
<tag name="console.command" command="secrets:set" />
</service>
<service id="console.command.secrets_remove" class="Symfony\Bundle\FrameworkBundle\Command\SecretsRemoveCommand">
<argument type="service" id="secrets.vault" />
<argument type="service" id="secrets.local_vault" on-invalid="ignore" />
<tag name="console.command" command="secrets:remove" />
</service>
<service id="console.command.secrets_generate_key" class="Symfony\Bundle\FrameworkBundle\Command\SecretsGenerateKeysCommand">
<argument type="service" id="secrets.vault" />
<argument type="service" id="secrets.local_vault" on-invalid="ignore" />
<tag name="console.command" command="secrets:generate-keys" />
</service>
<service id="console.command.secrets_list" class="Symfony\Bundle\FrameworkBundle\Command\SecretsListCommand">
<argument type="service" id="secrets.vault" />
<argument type="service" id="secrets.local_vault" on-invalid="ignore" />
<tag name="console.command" command="secrets:list" />
</service>
<service id="console.command.secrets_decrypt_to_local" class="Symfony\Bundle\FrameworkBundle\Command\SecretsDecryptToLocalCommand">
<argument type="service" id="secrets.vault" />
<argument type="service" id="secrets.local_vault" on-invalid="ignore" />
<tag name="console.command" command="secrets:decrypt-to-local" />
</service>
<service id="console.command.secrets_encrypt_from_local" class="Symfony\Bundle\FrameworkBundle\Command\SecretsEncryptFromLocalCommand">
<argument type="service" id="secrets.vault" />
<argument type="service" id="secrets.local_vault" on-invalid="ignore" />
<tag name="console.command" command="secrets:encrypt-from-local" />
</service>
</services>
</container>