Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 71a4ef4

Browse files
author
Christian Kolb
committed
Rename context flag
1 parent ea5c341 commit 71a4ef4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

components/serializer.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,11 +1242,11 @@ to ``true``::
12421242
$result = $normalizer->normalize($dummy, 'json', [AbstractObjectNormalizer::SKIP_NULL_VALUES => true]);
12431243
// ['bar' => 'notNull']
12441244

1245-
Preventing ``null`` Value Fallback for Nullable Properties
1246-
----------------------------------------------------------
1245+
Require all Properties
1246+
----------------------
12471247

12481248
By default, the Serializer will add ``null`` to nullable properties when the parameters for those are not provided.
1249-
You can change this behavior by setting the ``AbstractNormalizer::PREVENT_NULLABLE_FALLBACK`` context option
1249+
You can change this behavior by setting the ``AbstractNormalizer::REQUIRE_ALL_PROPERTIES`` context option
12501250
to ``true``::
12511251

12521252
class Dummy
@@ -1261,7 +1261,7 @@ to ``true``::
12611261
$data = ['foo' => 'notNull'];
12621262

12631263
$normalizer = new ObjectNormalizer();
1264-
$result = $normalizer->denormalize($data, Dummy::class, 'json', [AbstractNormalizer::PREVENT_NULLABLE_FALLBACK => true]);
1264+
$result = $normalizer->denormalize($data, Dummy::class, 'json', [AbstractNormalizer::REQUIRE_ALL_PROPERTIES => true]);
12651265
// throws Symfony\Component\Serializer\Exception\MissingConstructorArgumentException
12661266

12671267
.. versionadded:: 6.3

0 commit comments

Comments
 (0)