Skip to content

Commit

Permalink
fix: change order of mapping paths being loaded (api-platform#4465)
Browse files Browse the repository at this point in the history
Co-authored-by: Tomasz Grochowski <[email protected]>
Co-authored-by: Alan Poulain <[email protected]>
  • Loading branch information
3 people authored and vincentchalamon committed Oct 15, 2021
1 parent 0b36a0e commit 912dae1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## 2.7.0

* **BC**: `mapping.paths` in configuration should override bundles configuration (#4465)
* GraphQL: Add ability to use different pagination types for the queries of a resource (#4453)
* 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)
* 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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ private function getBundlesResourcesPaths(ContainerBuilder $container, array $co

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

// Flex structure (only if nothing specified)
$projectDir = $container->getParameter('kernel.project_dir');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@
use Nelmio\ApiDocBundle\NelmioApiDocBundle;
use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
use Prophecy\Exception\Doubler\MethodNotFoundException;
use Symfony\Bundle\SecurityBundle\SecurityBundle;
use Symfony\Component\Cache\Adapter\ArrayAdapter;
use Symfony\Component\Config\Resource\DirectoryResource;
Expand Down Expand Up @@ -899,16 +898,16 @@ static function (string $path): string {

self::assertSame(
$normalizePaths([
"{$fixturesDirectory}/Fixtures/TestBundle/Resources/config/api_resources.yml",
"{$fixturesDirectory}/Fixtures/TestBundle/Resources/config/api_resources/dummy_address.yml",
"{$fixturesDirectory}/Fixtures/TestBundle/Resources/config/api_resources/my_resource.yml",
"{$testsDirectory}/Bridge/Symfony/Bundle/DependencyInjection/Fixtures/resources/B.yaml",
"{$testsDirectory}/Bridge/Symfony/Bundle/DependencyInjection/Fixtures/resources/Bb.yaml",
"{$testsDirectory}/Bridge/Symfony/Bundle/DependencyInjection/Fixtures/resources/a.yaml",
"{$testsDirectory}/Bridge/Symfony/Bundle/DependencyInjection/Fixtures/resources/a/a.yaml",
"{$testsDirectory}/Bridge/Symfony/Bundle/DependencyInjection/Fixtures/resources/b/a.yaml",
"{$testsDirectory}/Bridge/Symfony/Bundle/DependencyInjection/Fixtures/resources/c.yaml",
"{$testsDirectory}/Bridge/Symfony/Bundle/DependencyInjection/Fixtures/resources/c/a.yaml",
"{$fixturesDirectory}/Fixtures/TestBundle/Resources/config/api_resources.yml",
"{$fixturesDirectory}/Fixtures/TestBundle/Resources/config/api_resources/dummy_address.yml",
"{$fixturesDirectory}/Fixtures/TestBundle/Resources/config/api_resources/my_resource.yml",
]),
$normalizePaths($paths)
);
Expand Down Expand Up @@ -1037,12 +1036,7 @@ private function getPartialContainerBuilderProphecy($configuration = null)
}

$containerBuilderProphecy->fileExists(Argument::type('string'))->shouldBeCalled();

try {
$containerBuilderProphecy->fileExists(Argument::type('string'))->shouldBeCalled();
} catch (MethodNotFoundException $e) {
$containerBuilderProphecy->addResource(Argument::type(ResourceInterface::class))->shouldBeCalled();
}
$containerBuilderProphecy->addResource(Argument::type(ResourceInterface::class))->shouldBeCalled();

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

Expand Down

0 comments on commit 912dae1

Please sign in to comment.