You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: core/getting-started.md
+19Lines changed: 19 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -196,6 +196,25 @@ resources:
196
196
pagination_items_per_page: 25# optional
197
197
```
198
198
199
+
If you prefer to use XML or YAML files instead of annotations, you must configure API Platform to load the appropriate files:
200
+
201
+
```yaml
202
+
# api/config/packages/api_platform.yaml
203
+
api_platform:
204
+
mapping:
205
+
paths:
206
+
- '%kernel.project_dir%/src/Entity'# default configuration for annotations
207
+
- '%kernel.project_dir%/config/api_platform'# yaml or xml directory configuration
208
+
```
209
+
210
+
The API Platform's configuration (annotations, `YAML` or `XML`) only allow to configure the context passed to the Symfony Serializer:
211
+
212
+
* 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)
213
+
* 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)
214
+
215
+
216
+
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).
217
+
199
218
**You're done!**
200
219
201
220
You now have a fully featured API exposing your entities.
0 commit comments