Skip to content

Commit baf1860

Browse files
fix: paths interpretation (#4876)
* fix: paths interpretation * fix: handle ApiResource path
1 parent f6efca4 commit baf1860

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/Symfony/Bundle/DependencyInjection/ApiPlatformExtension.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -307,10 +307,14 @@ private function getResourcesToWatch(ContainerBuilder $container, array $config)
307307
{
308308
$paths = array_unique(array_merge($this->getBundlesResourcesPaths($container, $config), $config['mapping']['paths']));
309309

310-
// Flex structure (only if nothing specified)
311-
$projectDir = $container->getParameter('kernel.project_dir');
312-
if (!$paths && is_dir($dir = "$projectDir/config/api_platform")) {
313-
$paths = [$dir];
310+
// Default paths
311+
if (!$paths) {
312+
$projectDir = $container->getParameter('kernel.project_dir');
313+
foreach (["$projectDir/config/api_platform", "$projectDir/src/ApiResource", "$projectDir/src/Document", "$projectDir/src/Entity"] as $dir) {
314+
if (is_dir($dir)) {
315+
$paths[] = $dir;
316+
}
317+
}
314318
}
315319

316320
$resources = ['yml' => [], 'xml' => [], 'dir' => []];

src/Symfony/Bundle/DependencyInjection/Configuration.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ public function getConfigTreeBuilder(): TreeBuilder
129129
->addDefaultsIfNotSet()
130130
->children()
131131
->arrayNode('paths')
132-
->defaultValue(['%kernel.project_dir%/src/ApiResource', '%kernel.project_dir%/src/Entity'])
133132
->prototype('scalar')->end()
134133
->end()
135134
->end()

tests/Symfony/Bundle/DependencyInjection/ConfigurationTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,7 @@ private function runDefaultConfigTests(array $doctrineIntegrationsToLoad = ['orm
167167
],
168168
],
169169
'mapping' => [
170-
'paths' => [
171-
'%kernel.project_dir%/src/ApiResource',
172-
'%kernel.project_dir%/src/Entity',
173-
],
170+
'paths' => [],
174171
],
175172
'http_cache' => [
176173
'invalidation' => [

0 commit comments

Comments
 (0)