Skip to content

Commit 9f1be36

Browse files
authored
Merge pull request #1360 from dunglas/fosuser
Enable FOSUser support if the bundle is installed
2 parents edc9fcf + e78787a commit 9f1be36

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/Bridge/Symfony/Bundle/DependencyInjection/Configuration.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
namespace ApiPlatform\Core\Bridge\Symfony\Bundle\DependencyInjection;
1515

1616
use ApiPlatform\Core\Exception\InvalidArgumentException;
17+
use FOS\UserBundle\FOSUserBundle;
1718
use Symfony\Bundle\TwigBundle\TwigBundle;
1819
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
1920
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
@@ -64,7 +65,7 @@ public function getConfigTreeBuilder()
6465
->booleanNode('force_eager')->defaultTrue()->info('Force join on every relation. If disabled, it will only join relations having the EAGER fetch mode.')->end()
6566
->end()
6667
->end()
67-
->booleanNode('enable_fos_user')->defaultValue(false)->info('Enable the FOSUserBundle integration.')->end()
68+
->booleanNode('enable_fos_user')->defaultValue(class_exists(FOSUserBundle::class))->info('Enable the FOSUserBundle integration.')->end()
6869
->booleanNode('enable_nelmio_api_doc')->defaultValue(false)->info('Enable the Nelmio Api doc integration.')->end()
6970
->booleanNode('enable_swagger')->defaultValue(true)->info('Enable the Swagger documentation and export.')->end()
7071
->booleanNode('enable_swagger_ui')->defaultValue(class_exists(TwigBundle::class))->info('Enable Swagger ui.')->end()

tests/Bridge/Symfony/Bundle/DependencyInjection/ConfigurationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function testDefaultConfig()
7070
'default_operation_path_resolver' => 'api_platform.operation_path_resolver.underscore',
7171
'path_segment_name_generator' => 'api_platform.path_segment_name_generator.underscore',
7272
'name_converter' => null,
73-
'enable_fos_user' => false,
73+
'enable_fos_user' => true,
7474
'enable_nelmio_api_doc' => false,
7575
'enable_swagger' => true,
7676
'enable_swagger_ui' => true,

0 commit comments

Comments
 (0)