Skip to content

Commit f63fd81

Browse files
authored
fix(symfony): define use_symfony_listeners (#6344)
* fix(symfony): define use_symfony_listeners * test
1 parent 3b8a006 commit f63fd81

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

docs/config/packages/framework.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ api_platform:
88
docs_formats:
99
jsonopenapi: ['application/vnd.openapi+json']
1010
keep_legacy_inflector: false
11+
use_symfony_listeners: false
1112
defaults:
1213
extra_properties:
1314
rfc_7807_compliant_errors: true

src/Symfony/Bundle/DependencyInjection/ApiPlatformExtension.php

+5
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,11 @@ private function registerCommonConfiguration(ContainerBuilder $container, array
218218
$loader->load('symfony/uid.xml');
219219
}
220220

221+
if (null === $config['use_symfony_listeners']) {
222+
$config['use_symfony_listeners'] = true;
223+
trigger_deprecation('api-platform/core', '3.3', 'Setting the value of "use_symfony_listeners" will be mandatory in 4.0 as it will default to "false". Use "true" if you use Symfony Controllers or Event Listeners.');
224+
}
225+
221226
// TODO: remove in 4.x
222227
$container->setParameter('api_platform.event_listeners_backward_compatibility_layer', $config['event_listeners_backward_compatibility_layer']);
223228
$container->setParameter('api_platform.use_symfony_listeners', $config['use_symfony_listeners']);

src/Symfony/Bundle/DependencyInjection/Configuration.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ public function getConfigTreeBuilder(): TreeBuilder
8686
->defaultValue('0.0.0')
8787
->end()
8888
->booleanNode('show_webby')->defaultTrue()->info('If true, show Webby on the documentation page')->end()
89-
->booleanNode('event_listeners_backward_compatibility_layer')->defaultNull()->info('If true API Platform uses Symfony event listeners instead of providers and processors.')->end() // TODO: Add link to the documentation
90-
->booleanNode('use_symfony_listeners')->defaultFalse()->info(sprintf('Uses Symfony event listeners instead of the %s.', MainController::class))->end() // TODO: Add link to the documentation
89+
->booleanNode('event_listeners_backward_compatibility_layer')->defaultNull()->info('If true API Platform uses Symfony event listeners instead of providers and processors.')->end()
90+
->booleanNode('use_symfony_listeners')->defaultNull()->info(sprintf('Uses Symfony event listeners instead of the %s.', MainController::class))->end()
9191
->scalarNode('name_converter')->defaultNull()->info('Specify a name converter to use.')->end()
9292
->scalarNode('asset_package')->defaultNull()->info('Specify an asset package name to use.')->end()
9393
->scalarNode('path_segment_name_generator')->defaultValue('api_platform.metadata.path_segment_name_generator.underscore')->info('Specify a path name generator to use.')->end()

0 commit comments

Comments
 (0)