Skip to content

Commit f7f605d

Browse files
authored
fix: check that api-platform/ramsey-uuid is installed before registering related services (api-platform#6696)
* fix: check that api-platform/ramsey-uuid is installed before registering related services * fix: suggest in Symfony's package composer.json
1 parent 6dfa89b commit f7f605d

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/Symfony/Bundle/DependencyInjection/ApiPlatformExtension.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
use ApiPlatform\Metadata\UriVariableTransformerInterface;
3939
use ApiPlatform\Metadata\UrlGeneratorInterface;
4040
use ApiPlatform\Problem\Serializer\ConstraintViolationListNormalizer;
41+
use ApiPlatform\RamseyUuid\Serializer\UuidDenormalizer;
4142
use ApiPlatform\State\ApiResource\Error;
4243
use ApiPlatform\State\ParameterProviderInterface;
4344
use ApiPlatform\State\ProcessorInterface;
@@ -221,7 +222,7 @@ private function registerCommonConfiguration(ContainerBuilder $container, array
221222
$loader->load('api.xml');
222223
$loader->load('filter.xml');
223224

224-
if (class_exists(Uuid::class)) {
225+
if (class_exists(UuidDenormalizer::class) && class_exists(Uuid::class)) {
225226
$loader->load('ramsey_uuid.xml');
226227
}
227228

src/Symfony/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@
6060
"api-platform/doctrine-odm": "To support MongoDB. Only versions 4.0 and later are supported.",
6161
"api-platform/elasticsearch": "To support Elasticsearch.",
6262
"api-platform/graphql": "To support GraphQL.",
63+
"api-platform/ramsey-uuid": "To support Ramsey's UUID identifiers.",
6364
"ocramius/package-versions": "To display the API Platform's version in the debug bar.",
6465
"phpstan/phpdoc-parser": "To support extracting metadata from PHPDoc.",
6566
"psr/cache-implementation": "To use metadata caching.",
66-
"ramsey/uuid": "To support Ramsey's UUID identifiers.",
6767
"symfony/cache": "To have metadata caching when using Symfony integration.",
6868
"symfony/config": "To load XML configuration files.",
6969
"symfony/expression-language": "To use authorization and mercure advanced features.",

0 commit comments

Comments
 (0)