|
14 | 14 | use Symfony\Bundle\FrameworkBundle\HttpCache\HttpCache; |
15 | 15 | use Symfony\Component\Config\Resource\SelfCheckingResourceChecker; |
16 | 16 | use Symfony\Component\Config\ResourceCheckerConfigCacheFactory; |
17 | | -use Symfony\Component\Console\Event\ConsoleCommandEvent; |
18 | | -use Symfony\Component\Console\Event\ConsoleErrorEvent; |
19 | | -use Symfony\Component\Console\Event\ConsoleTerminateEvent; |
| 17 | +use Symfony\Component\Console\ConsoleEvents; |
20 | 18 | use Symfony\Component\DependencyInjection\Config\ContainerParametersResourceChecker; |
21 | 19 | use Symfony\Component\DependencyInjection\EnvVarProcessor; |
22 | 20 | use Symfony\Component\DependencyInjection\ParameterBag\ContainerBag; |
|
26 | 24 | use Symfony\Component\EventDispatcher\EventDispatcher; |
27 | 25 | use Symfony\Component\EventDispatcher\EventDispatcherInterface as EventDispatcherInterfaceComponentAlias; |
28 | 26 | use Symfony\Component\Filesystem\Filesystem; |
29 | | -use Symfony\Component\Form\Event\PostSetDataEvent; |
30 | | -use Symfony\Component\Form\Event\PostSubmitEvent; |
31 | | -use Symfony\Component\Form\Event\PreSetDataEvent; |
32 | | -use Symfony\Component\Form\Event\PreSubmitEvent; |
33 | | -use Symfony\Component\Form\Event\SubmitEvent; |
| 27 | +use Symfony\Component\Form\FormEvents; |
34 | 28 | use Symfony\Component\HttpFoundation\RequestStack; |
35 | 29 | use Symfony\Component\HttpFoundation\UrlHelper; |
36 | 30 | use Symfony\Component\HttpKernel\CacheClearer\ChainCacheClearer; |
37 | 31 | use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate; |
38 | 32 | use Symfony\Component\HttpKernel\Config\FileLocator; |
39 | 33 | use Symfony\Component\HttpKernel\DependencyInjection\ServicesResetter; |
40 | | -use Symfony\Component\HttpKernel\Event\ControllerArgumentsEvent; |
41 | | -use Symfony\Component\HttpKernel\Event\ControllerEvent; |
42 | | -use Symfony\Component\HttpKernel\Event\ExceptionEvent; |
43 | | -use Symfony\Component\HttpKernel\Event\FinishRequestEvent; |
44 | | -use Symfony\Component\HttpKernel\Event\RequestEvent; |
45 | | -use Symfony\Component\HttpKernel\Event\ResponseEvent; |
46 | | -use Symfony\Component\HttpKernel\Event\TerminateEvent; |
47 | | -use Symfony\Component\HttpKernel\Event\ViewEvent; |
48 | 34 | use Symfony\Component\HttpKernel\EventListener\LocaleAwareListener; |
49 | 35 | use Symfony\Component\HttpKernel\HttpCache\Store; |
50 | 36 | use Symfony\Component\HttpKernel\HttpKernel; |
51 | 37 | use Symfony\Component\HttpKernel\HttpKernelInterface; |
| 38 | +use Symfony\Component\HttpKernel\KernelEvents; |
52 | 39 | use Symfony\Component\HttpKernel\KernelInterface; |
53 | 40 | use Symfony\Component\HttpKernel\UriSigner; |
54 | 41 | use Symfony\Component\String\LazyString; |
55 | 42 | use Symfony\Component\String\Slugger\AsciiSlugger; |
56 | 43 | use Symfony\Component\String\Slugger\SluggerInterface; |
57 | | -use Symfony\Component\Workflow\Event\AnnounceEvent; |
58 | | -use Symfony\Component\Workflow\Event\CompletedEvent; |
59 | | -use Symfony\Component\Workflow\Event\EnteredEvent; |
60 | | -use Symfony\Component\Workflow\Event\EnterEvent; |
61 | | -use Symfony\Component\Workflow\Event\GuardEvent; |
62 | | -use Symfony\Component\Workflow\Event\LeaveEvent; |
63 | | -use Symfony\Component\Workflow\Event\TransitionEvent; |
| 44 | +use Symfony\Component\Workflow\WorkflowEvents; |
64 | 45 | use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; |
65 | 46 |
|
66 | 47 | return static function (ContainerConfigurator $container) { |
67 | 48 | // this parameter is used at compile time in RegisterListenersPass |
68 | | - $container->parameters()->set('event_dispatcher.event_aliases', [ |
69 | | - ConsoleCommandEvent::class => 'console.command', |
70 | | - ConsoleErrorEvent::class => 'console.error', |
71 | | - ConsoleTerminateEvent::class => 'console.terminate', |
72 | | - PreSubmitEvent::class => 'form.pre_submit', |
73 | | - SubmitEvent::class => 'form.submit', |
74 | | - PostSubmitEvent::class => 'form.post_submit', |
75 | | - PreSetDataEvent::class => 'form.pre_set_data', |
76 | | - PostSetDataEvent::class => 'form.post_set_data', |
77 | | - ControllerArgumentsEvent::class => 'kernel.controller_arguments', |
78 | | - ControllerEvent::class => 'kernel.controller', |
79 | | - ResponseEvent::class => 'kernel.response', |
80 | | - FinishRequestEvent::class => 'kernel.finish_request', |
81 | | - RequestEvent::class => 'kernel.request', |
82 | | - ViewEvent::class => 'kernel.view', |
83 | | - ExceptionEvent::class => 'kernel.exception', |
84 | | - TerminateEvent::class => 'kernel.terminate', |
85 | | - GuardEvent::class => 'workflow.guard', |
86 | | - LeaveEvent::class => 'workflow.leave', |
87 | | - TransitionEvent::class => 'workflow.transition', |
88 | | - EnterEvent::class => 'workflow.enter', |
89 | | - EnteredEvent::class => 'workflow.entered', |
90 | | - CompletedEvent::class => 'workflow.completed', |
91 | | - AnnounceEvent::class => 'workflow.announce', |
92 | | - ]); |
| 49 | + $container->parameters()->set('event_dispatcher.event_aliases', array_merge( |
| 50 | + class_exists(ConsoleEvents::class) ? ConsoleEvents::ALIASES : [], |
| 51 | + class_exists(FormEvents::class) ? FormEvents::ALIASES : [], |
| 52 | + KernelEvents::ALIASES, |
| 53 | + class_exists(WorkflowEvents::class) ? WorkflowEvents::ALIASES : [] |
| 54 | + )); |
93 | 55 |
|
94 | 56 | $container->services() |
95 | 57 |
|
|
0 commit comments