Skip to content

Commit 8d27e45

Browse files
committed
minor #37216 [FrameworkBundle] Move console configuration to PHP (Ahmed Raafat)
This PR was merged into the 5.2-dev branch. Discussion ---------- [FrameworkBundle] Move console configuration to PHP | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | #37186 | License | MIT | Doc PR | n/a Commits ------- ef01839 [FrameworkBundle] Move console configuration to PHP
2 parents cef93ea + ef01839 commit 8d27e45

File tree

3 files changed

+291
-234
lines changed

3 files changed

+291
-234
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ public function load(array $configs, ContainerBuilder $container)
185185
$container->registerAliasForArgument('parameter_bag', PsrContainerInterface::class);
186186

187187
if (class_exists(Application::class)) {
188-
$loader->load('console.xml');
188+
$phpLoader->load('console.php');
189189

190190
if (!class_exists(BaseXliffLintCommand::class)) {
191191
$container->removeDefinition('console.command.xliff_lint');
Lines changed: 290 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,290 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
13+
14+
use Symfony\Bundle\FrameworkBundle\Command\AboutCommand;
15+
use Symfony\Bundle\FrameworkBundle\Command\AssetsInstallCommand;
16+
use Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand;
17+
use Symfony\Bundle\FrameworkBundle\Command\CachePoolClearCommand;
18+
use Symfony\Bundle\FrameworkBundle\Command\CachePoolDeleteCommand;
19+
use Symfony\Bundle\FrameworkBundle\Command\CachePoolListCommand;
20+
use Symfony\Bundle\FrameworkBundle\Command\CachePoolPruneCommand;
21+
use Symfony\Bundle\FrameworkBundle\Command\CacheWarmupCommand;
22+
use Symfony\Bundle\FrameworkBundle\Command\ConfigDebugCommand;
23+
use Symfony\Bundle\FrameworkBundle\Command\ConfigDumpReferenceCommand;
24+
use Symfony\Bundle\FrameworkBundle\Command\ContainerDebugCommand;
25+
use Symfony\Bundle\FrameworkBundle\Command\ContainerLintCommand;
26+
use Symfony\Bundle\FrameworkBundle\Command\DebugAutowiringCommand;
27+
use Symfony\Bundle\FrameworkBundle\Command\EventDispatcherDebugCommand;
28+
use Symfony\Bundle\FrameworkBundle\Command\RouterDebugCommand;
29+
use Symfony\Bundle\FrameworkBundle\Command\RouterMatchCommand;
30+
use Symfony\Bundle\FrameworkBundle\Command\SecretsDecryptToLocalCommand;
31+
use Symfony\Bundle\FrameworkBundle\Command\SecretsEncryptFromLocalCommand;
32+
use Symfony\Bundle\FrameworkBundle\Command\SecretsGenerateKeysCommand;
33+
use Symfony\Bundle\FrameworkBundle\Command\SecretsListCommand;
34+
use Symfony\Bundle\FrameworkBundle\Command\SecretsRemoveCommand;
35+
use Symfony\Bundle\FrameworkBundle\Command\SecretsSetCommand;
36+
use Symfony\Bundle\FrameworkBundle\Command\TranslationDebugCommand;
37+
use Symfony\Bundle\FrameworkBundle\Command\TranslationUpdateCommand;
38+
use Symfony\Bundle\FrameworkBundle\Command\WorkflowDumpCommand;
39+
use Symfony\Bundle\FrameworkBundle\Command\YamlLintCommand;
40+
use Symfony\Bundle\FrameworkBundle\EventListener\SuggestMissingPackageSubscriber;
41+
use Symfony\Component\Console\EventListener\ErrorListener;
42+
use Symfony\Component\Messenger\Command\ConsumeMessagesCommand;
43+
use Symfony\Component\Messenger\Command\DebugCommand;
44+
use Symfony\Component\Messenger\Command\FailedMessagesRemoveCommand;
45+
use Symfony\Component\Messenger\Command\FailedMessagesRetryCommand;
46+
use Symfony\Component\Messenger\Command\FailedMessagesShowCommand;
47+
use Symfony\Component\Messenger\Command\SetupTransportsCommand;
48+
use Symfony\Component\Messenger\Command\StopWorkersCommand;
49+
use Symfony\Component\Translation\Command\XliffLintCommand;
50+
51+
return static function (ContainerConfigurator $container) {
52+
$container->services()
53+
->set('console.error_listener', ErrorListener::class)
54+
->args([
55+
service('logger')->nullOnInvalid(),
56+
])
57+
->tag('kernel.event_subscriber')
58+
->tag('monolog.logger', ['channel' => 'console'])
59+
60+
->set('console.suggest_missing_package_subscriber', SuggestMissingPackageSubscriber::class)
61+
->tag('kernel.event_subscriber')
62+
63+
->set('console.command.about', AboutCommand::class)
64+
->tag('console.command', ['command' => 'about'])
65+
66+
->set('console.command.assets_install', AssetsInstallCommand::class)
67+
->args([
68+
service('filesystem'),
69+
param('kernel.project_dir'),
70+
])
71+
->tag('console.command', ['command' => 'assets:install'])
72+
73+
->set('console.command.cache_clear', CacheClearCommand::class)
74+
->args([
75+
service('cache_clearer'),
76+
service('filesystem'),
77+
])
78+
->tag('console.command', ['command' => 'cache:clear'])
79+
80+
->set('console.command.cache_pool_clear', CachePoolClearCommand::class)
81+
->args([
82+
service('cache.global_clearer'),
83+
])
84+
->tag('console.command', ['command' => 'cache:pool:clear'])
85+
86+
->set('console.command.cache_pool_prune', CachePoolPruneCommand::class)
87+
->args([
88+
[],
89+
])
90+
->tag('console.command', ['command' => 'cache:pool:prune'])
91+
92+
->set('console.command.cache_pool_delete', CachePoolDeleteCommand::class)
93+
->args([
94+
service('cache.global_clearer'),
95+
])
96+
->tag('console.command', ['command' => 'cache:pool:delete'])
97+
98+
->set('console.command.cache_pool_list', CachePoolListCommand::class)
99+
->args([
100+
null,
101+
])
102+
->tag('console.command', ['command' => 'cache:pool:list'])
103+
104+
->set('console.command.cache_warmup', CacheWarmupCommand::class)
105+
->args([
106+
service('cache_warmer'),
107+
])
108+
->tag('console.command', ['command' => 'cache:warmup'])
109+
110+
->set('console.command.config_debug', ConfigDebugCommand::class)
111+
->tag('console.command', ['command' => 'debug:config'])
112+
113+
->set('console.command.config_dump_reference', ConfigDumpReferenceCommand::class)
114+
->tag('console.command', ['command' => 'config:dump-reference'])
115+
116+
->set('console.command.container_debug', ContainerDebugCommand::class)
117+
->tag('console.command', ['command' => 'debug:container'])
118+
119+
->set('console.command.container_lint', ContainerLintCommand::class)
120+
->tag('console.command', ['command' => 'lint:container'])
121+
122+
->set('console.command.debug_autowiring', DebugAutowiringCommand::class)
123+
->args([
124+
null,
125+
service('debug.file_link_formatter')->nullOnInvalid(),
126+
])
127+
->tag('console.command', ['command' => 'debug:autowiring'])
128+
129+
->set('console.command.event_dispatcher_debug', EventDispatcherDebugCommand::class)
130+
->args([
131+
service('event_dispatcher'),
132+
])
133+
->tag('console.command', ['command' => 'debug:event-dispatcher'])
134+
135+
->set('console.command.messenger_consume_messages', ConsumeMessagesCommand::class)
136+
->args([
137+
abstract_arg('Routable message bus'),
138+
service('messenger.receiver_locator'),
139+
service('event_dispatcher'),
140+
service('logger')->nullOnInvalid(),
141+
[], // Receiver names
142+
])
143+
->tag('console.command', ['command' => 'messenger:consume'])
144+
->tag('monolog.logger', ['channel' => 'messenger'])
145+
146+
->set('console.command.messenger_setup_transports', SetupTransportsCommand::class)
147+
->args([
148+
service('messenger.receiver_locator'),
149+
[], // Receiver names
150+
])
151+
->tag('console.command', ['command' => 'messenger:setup-transports'])
152+
153+
->set('console.command.messenger_debug', DebugCommand::class)
154+
->args([
155+
[], // Message to handlers mapping
156+
])
157+
->tag('console.command', ['command' => 'debug:messenger'])
158+
159+
->set('console.command.messenger_stop_workers', StopWorkersCommand::class)
160+
->args([
161+
service('cache.messenger.restart_workers_signal'),
162+
])
163+
->tag('console.command', ['command' => 'messenger:stop-workers'])
164+
165+
->set('console.command.messenger_failed_messages_retry', FailedMessagesRetryCommand::class)
166+
->args([
167+
abstract_arg('Receiver name'),
168+
abstract_arg('Receiver'),
169+
service('messenger.routable_message_bus'),
170+
service('event_dispatcher'),
171+
service('logger'),
172+
])
173+
->tag('console.command', ['command' => 'messenger:failed:retry'])
174+
175+
->set('console.command.messenger_failed_messages_show', FailedMessagesShowCommand::class)
176+
->args([
177+
abstract_arg('Receiver name'),
178+
abstract_arg('Receiver'),
179+
])
180+
->tag('console.command', ['command' => 'messenger:failed:show'])
181+
182+
->set('console.command.messenger_failed_messages_remove', FailedMessagesRemoveCommand::class)
183+
->args([
184+
abstract_arg('Receiver name'),
185+
abstract_arg('Receiver'),
186+
])
187+
->tag('console.command', ['command' => 'messenger:failed:remove'])
188+
189+
->set('console.command.router_debug', RouterDebugCommand::class)
190+
->args([
191+
service('router'),
192+
service('debug.file_link_formatter')->nullOnInvalid(),
193+
])
194+
->tag('console.command', ['command' => 'debug:router'])
195+
196+
->set('console.command.router_match', RouterMatchCommand::class)
197+
->args([
198+
service('router'),
199+
tagged_iterator('routing.expression_language_provider'),
200+
])
201+
->tag('console.command', ['command' => 'router:match'])
202+
203+
->set('console.command.translation_debug', TranslationDebugCommand::class)
204+
->args([
205+
service('translator'),
206+
service('translation.reader'),
207+
service('translation.extractor'),
208+
param('translator.default_path'),
209+
null, // twig.default_path
210+
[], // Translator paths
211+
[], // Twig paths
212+
])
213+
->tag('console.command', ['command' => 'debug:translation'])
214+
215+
->set('console.command.translation_update', TranslationUpdateCommand::class)
216+
->args([
217+
service('translation.writer'),
218+
service('translation.reader'),
219+
service('translation.extractor'),
220+
param('kernel.default_locale'),
221+
param('translator.default_path'),
222+
null, // twig.default_path
223+
[], // Translator paths
224+
[], // Twig paths
225+
])
226+
->tag('console.command', ['command' => 'translation:update'])
227+
228+
->set('console.command.workflow_dump', WorkflowDumpCommand::class)
229+
->tag('console.command', ['command' => 'workflow:dump'])
230+
231+
->set('console.command.xliff_lint', XliffLintCommand::class)
232+
->tag('console.command', ['command' => 'lint:xliff'])
233+
234+
->set('console.command.yaml_lint', YamlLintCommand::class)
235+
->tag('console.command', ['command' => 'lint:yaml'])
236+
237+
->set('console.command.form_debug', \Symfony\Component\Form\Command\DebugCommand::class)
238+
->args([
239+
service('form.registry'),
240+
[], // All form types namespaces are stored here by FormPass
241+
[], // All services form types are stored here by FormPass
242+
[], // All type extensions are stored here by FormPass
243+
[], // All type guessers are stored here by FormPass
244+
service('debug.file_link_formatter')->nullOnInvalid(),
245+
])
246+
->tag('console.command', ['command' => 'debug:form'])
247+
248+
->set('console.command.secrets_set', SecretsSetCommand::class)
249+
->args([
250+
service('secrets.vault'),
251+
service('secrets.local_vault')->nullOnInvalid(),
252+
])
253+
->tag('console.command', ['command' => 'secrets:set'])
254+
255+
->set('console.command.secrets_remove', SecretsRemoveCommand::class)
256+
->args([
257+
service('secrets.vault'),
258+
service('secrets.local_vault')->nullOnInvalid(),
259+
])
260+
->tag('console.command', ['command' => 'secrets:remove'])
261+
262+
->set('console.command.secrets_generate_key', SecretsGenerateKeysCommand::class)
263+
->args([
264+
service('secrets.vault'),
265+
service('secrets.local_vault')->ignoreOnInvalid(),
266+
])
267+
->tag('console.command', ['command' => 'secrets:generate-keys'])
268+
269+
->set('console.command.secrets_list', SecretsListCommand::class)
270+
->args([
271+
service('secrets.vault'),
272+
service('secrets.local_vault'),
273+
])
274+
->tag('console.command', ['command' => 'secrets:list'])
275+
276+
->set('console.command.secrets_decrypt_to_local', SecretsDecryptToLocalCommand::class)
277+
->args([
278+
service('secrets.vault'),
279+
service('secrets.local_vault')->ignoreOnInvalid(),
280+
])
281+
->tag('console.command', ['command' => 'secrets:decrypt-to-local'])
282+
283+
->set('console.command.secrets_encrypt_from_local', SecretsEncryptFromLocalCommand::class)
284+
->args([
285+
service('secrets.vault'),
286+
service('secrets.local_vault'),
287+
])
288+
->tag('console.command', ['command' => 'secrets:encrypt-from-local'])
289+
;
290+
};

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy