Skip to content

Commit 98e4439

Browse files
tbuczenalanpoulain
andauthored
fix: change order of mapping paths being loaded (#4465)
Co-authored-by: Tomasz Grochowski <[email protected]> Co-authored-by: Alan Poulain <[email protected]>
1 parent 594e4bf commit 98e4439

File tree

3 files changed

+6
-11
lines changed

3 files changed

+6
-11
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## 2.7.0
44

5+
* **BC**: `mapping.paths` in configuration should override bundles configuration (#4465)
56
* GraphQL: Add ability to use different pagination types for the queries of a resource (#4453)
67
* Security: **BC** Fix `ApiProperty` `security` attribute expression being passed a class string for the `object` variable on updates/creates - null is now passed instead if the object is not available (#4184)
78
* Security: `ApiProperty` now supports a `security_post_denormalize` attribute, which provides access to the `object` variable for the object being updated/created and `previous_object` for the object before it was updated (#4184)

src/Core/Bridge/Symfony/Bundle/DependencyInjection/ApiPlatformExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ private function getBundlesResourcesPaths(ContainerBuilder $container, array $co
330330

331331
private function getResourcesToWatch(ContainerBuilder $container, array $config): array
332332
{
333-
$paths = array_unique(array_merge($config['mapping']['paths'], $this->getBundlesResourcesPaths($container, $config)));
333+
$paths = array_unique(array_merge($this->getBundlesResourcesPaths($container, $config), $config['mapping']['paths']));
334334

335335
// Flex structure (only if nothing specified)
336336
$projectDir = $container->getParameter('kernel.project_dir');

tests/Core/Bridge/Symfony/Bundle/DependencyInjection/ApiPlatformExtensionTest.php

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@
101101
use Nelmio\ApiDocBundle\NelmioApiDocBundle;
102102
use PHPUnit\Framework\TestCase;
103103
use Prophecy\Argument;
104-
use Prophecy\Exception\Doubler\MethodNotFoundException;
105104
use Symfony\Bundle\SecurityBundle\SecurityBundle;
106105
use Symfony\Component\Cache\Adapter\ArrayAdapter;
107106
use Symfony\Component\Config\Resource\DirectoryResource;
@@ -899,16 +898,16 @@ static function (string $path): string {
899898

900899
self::assertSame(
901900
$normalizePaths([
901+
"{$fixturesDirectory}/Fixtures/TestBundle/Resources/config/api_resources.yml",
902+
"{$fixturesDirectory}/Fixtures/TestBundle/Resources/config/api_resources/dummy_address.yml",
903+
"{$fixturesDirectory}/Fixtures/TestBundle/Resources/config/api_resources/my_resource.yml",
902904
"{$testsDirectory}/Bridge/Symfony/Bundle/DependencyInjection/Fixtures/resources/B.yaml",
903905
"{$testsDirectory}/Bridge/Symfony/Bundle/DependencyInjection/Fixtures/resources/Bb.yaml",
904906
"{$testsDirectory}/Bridge/Symfony/Bundle/DependencyInjection/Fixtures/resources/a.yaml",
905907
"{$testsDirectory}/Bridge/Symfony/Bundle/DependencyInjection/Fixtures/resources/a/a.yaml",
906908
"{$testsDirectory}/Bridge/Symfony/Bundle/DependencyInjection/Fixtures/resources/b/a.yaml",
907909
"{$testsDirectory}/Bridge/Symfony/Bundle/DependencyInjection/Fixtures/resources/c.yaml",
908910
"{$testsDirectory}/Bridge/Symfony/Bundle/DependencyInjection/Fixtures/resources/c/a.yaml",
909-
"{$fixturesDirectory}/Fixtures/TestBundle/Resources/config/api_resources.yml",
910-
"{$fixturesDirectory}/Fixtures/TestBundle/Resources/config/api_resources/dummy_address.yml",
911-
"{$fixturesDirectory}/Fixtures/TestBundle/Resources/config/api_resources/my_resource.yml",
912911
]),
913912
$normalizePaths($paths)
914913
);
@@ -1037,12 +1036,7 @@ private function getPartialContainerBuilderProphecy($configuration = null)
10371036
}
10381037

10391038
$containerBuilderProphecy->fileExists(Argument::type('string'))->shouldBeCalled();
1040-
1041-
try {
1042-
$containerBuilderProphecy->fileExists(Argument::type('string'))->shouldBeCalled();
1043-
} catch (MethodNotFoundException $e) {
1044-
$containerBuilderProphecy->addResource(Argument::type(ResourceInterface::class))->shouldBeCalled();
1045-
}
1039+
$containerBuilderProphecy->addResource(Argument::type(ResourceInterface::class))->shouldBeCalled();
10461040

10471041
$containerBuilderProphecy->hasExtension('http://symfony.com/schema/dic/services')->shouldBeCalled();
10481042

0 commit comments

Comments
 (0)