Skip to content

Commit 393f92f

Browse files
authored
Merge pull request #724 from jdeniau/jd-fix-serializationClarification
Clean serialization incomplete informations from getting started section
2 parents 3e501d4 + d82147c commit 393f92f

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

core/getting-started.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -215,13 +215,7 @@ api_platform:
215215
- '%kernel.project_dir%/config/api_platform' # yaml or xml directory configuration
216216
```
217217
218-
The API Platform's configuration (annotations, `YAML` or `XML`) only allow to configure the context passed to the Symfony Serializer:
219-
220-
* The `normalization_context` key will be passed as 3rd argument of [the `Serializer::serialize()` method](https://api.symfony.com/master/Symfony/Component/Serializer/SerializerInterface.html#method_serialize)
221-
* The `denormalization_context` key will be passed as 4th argument of [the `Serializer::deserialize()` method](https://api.symfony.com/master/Symfony/Component/Serializer/SerializerInterface.html#method_deserialize)
222-
223-
224-
To configure the serialization groups of classes's properties, you must use directly [the Symfony Serializer's configuration files or annotations](https://symfony.com/doc/current/components/serializer.html#attributes-groups).
218+
If you want to serialize only a subset of your data, please refer to the [Serialization documentation](serialization.md).
225219
226220
**You're done!**
227221

core/serialization.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,11 @@ In the previous example, the `name` property will be visible when reading (`GET`
142142
to write (`PUT/POST`). The `author` property will be write-only; it will not be visible when serialized responses are
143143
returned by the API.
144144

145-
Internally, API Platform passes the value of the `normalization_context` to the Symfony Serializer during the normalization
146-
process; `denormalization_context` is passed during denormalization (writing).
145+
Internally, API Platform passes the value of the `normalization_context` as the 3rd argument of [the `Serializer::serialize()` method](https://api.symfony.com/master/Symfony/Component/Serializer/SerializerInterface.html#method_serialize) during the normalization
146+
process; `denormalization_context` is passed as the 4th argument of [the `Serializer::deserialize()` method](https://api.symfony.com/master/Symfony/Component/Serializer/SerializerInterface.html#method_deserialize) during denormalization (writing).
147+
148+
To configure the serialization groups of classes's properties, you must use directly [the Symfony Serializer's configuration files or annotations](https://symfony.com/doc/current/components/serializer.html#attributes-groups).
149+
147150

148151
In addition to the `groups` key, you can configure any Symfony Serializer option through the `$context` parameter
149152
(e.g. the `enable_max_depth`key when using [the `@MaxDepth` annotation](https://symfony.com/doc/current/components/serializer.html#handling-serialization-depth)).

0 commit comments

Comments
 (0)