Skip to content

Commit 288b47c

Browse files
committed
fix: default format and standard_put values
1 parent fcb78ea commit 288b47c

File tree

6 files changed

+7
-7
lines changed

6 files changed

+7
-7
lines changed

src/Doctrine/Common/State/PersistProcessor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function process(mixed $data, Operation $operation, array $uriVariables =
4848
// PUT: reset the existing object managed by Doctrine and merge data sent by the user in it
4949
// This custom logic is needed because EntityManager::merge() has been deprecated and UPSERT isn't supported:
5050
// https://github.com/doctrine/orm/issues/8461#issuecomment-1250233555
51-
if ($operation instanceof HttpOperation && 'PUT' === $operation->getMethod() && ($operation->getExtraProperties()['standard_put'] ?? false)) {
51+
if ($operation instanceof HttpOperation && 'PUT' === $operation->getMethod() && ($operation->getExtraProperties()['standard_put'] ?? true)) {
5252
\assert(method_exists($manager, 'getReference'));
5353
$newData = $data;
5454
$identifiers = array_reverse($uriVariables);

src/JsonLd/Serializer/ItemNormalizer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ public function denormalize(mixed $data, string $class, ?string $format = null,
175175
} catch (ItemNotFoundException $e) {
176176
$operation = $context['operation'] ?? null;
177177

178-
if (!('PUT' === $operation?->getMethod() && ($operation->getExtraProperties()['standard_put'] ?? false))) {
178+
if (!('PUT' === $operation?->getMethod() && ($operation->getExtraProperties()['standard_put'] ?? true))) {
179179
throw $e;
180180
}
181181
}

src/State/Provider/DeserializeProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public function provide(Operation $operation, array $uriVariables = [], array $c
8383
&& (
8484
'POST' === $method
8585
|| 'PATCH' === $method
86-
|| ('PUT' === $method && !($operation->getExtraProperties()['standard_put'] ?? false))
86+
|| ('PUT' === $method && !($operation->getExtraProperties()['standard_put'] ?? true))
8787
)
8888
) {
8989
$serializerContext[AbstractNormalizer::OBJECT_TO_POPULATE] = $data;

src/Symfony/Bundle/DependencyInjection/Configuration.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ public function getConfigTreeBuilder(): TreeBuilder
164164
$this->addExceptionToStatusSection($rootNode);
165165

166166
$this->addFormatSection($rootNode, 'formats', [
167+
'jsonld' => ['mime_types' => ['application/ld+json']]
167168
]);
168169
$this->addFormatSection($rootNode, 'patch_formats', [
169170
'json' => ['mime_types' => ['application/merge-patch+json']],

tests/Fixtures/app/AppKernel.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,9 +265,6 @@ class_exists(NativePasswordHasher::class) ? 'password_hashers' : 'encoders' => [
265265
'public' => true,
266266
],
267267
'normalization_context' => ['skip_null_values' => false],
268-
'extra_properties' => [
269-
'standard_put' => true,
270-
],
271268
'operations' => [
272269
Get::class,
273270
GetCollection::class,

tests/Symfony/Bundle/DependencyInjection/ConfigurationTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ private function runDefaultConfigTests(array $doctrineIntegrationsToLoad = ['orm
7575
'description' => 'description',
7676
'version' => '1.0.0',
7777
'show_webby' => true,
78-
'formats' => [],
78+
'formats' => [
79+
'jsonld' => ['mime_types' => ['application/ld+json']],
80+
],
7981
'docs_formats' => [
8082
'jsonopenapi' => ['mime_types' => ['application/vnd.openapi+json']],
8183
'yamlopenapi' => ['mime_types' => ['application/vnd.openapi+yaml']],

0 commit comments

Comments
 (0)