Skip to content

Commit f4e609c

Browse files
authored
Re-add mistakenly removed service definition.
Either the service definition should have stayed in the document or the line saying "First register the following service:" should have been removed. I went with the former.
1 parent 4473c57 commit f4e609c

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

core/fosuser-bundle.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,22 @@ you can modify are handled with [`denormalization_context`](serialization-groups
1212

1313
First register the following service:
1414

15+
```yaml
16+
# app/config/services.yml
17+
18+
resource.user:
19+
parent: "api.resource"
20+
arguments: [ "AppBundle\Entity\User" ]
21+
calls:
22+
- method: "initNormalizationContext"
23+
arguments: [ { groups: [ "user_read" ] } ]
24+
- method: "initDenormalizationContext"
25+
arguments: [ { groups: [ "user_write" ] } ]
26+
tags: [ { name: "api.resource" } ]
27+
```
28+
29+
Then create your User entity with serialization groups:
30+
1531
```php
1632
<?php
1733

0 commit comments

Comments
 (0)