Skip to content

Commit 0545f6b

Browse files
Decorate a Serializer when JSON data is provided
1 parent dd1e7f4 commit 0545f6b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

core/serialization.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,15 @@ services:
703703
arguments: [ '@App\Serializer\ApiNormalizer.inner' ]
704704
```
705705

706+
Note: this normalizer will work only for JSON-LD format, if you want to process JSON data too, you have to decorate another service:
707+
708+
```yaml
709+
app.serializer.app_normalizer.json:
710+
class: App\Serializer\ApiNormalizer
711+
decorates: 'api_platform.serializer.normalizer.item'
712+
arguments: [ '@app.serializer.app_normalizer.json.inner' ]
713+
```
714+
706715
```php
707716
<?php
708717
// api/src/Serializer/ApiNormalizer

0 commit comments

Comments
 (0)