Skip to content

Commit 76eb1e8

Browse files
trsteel88dunglas
authored andcommitted
Add a yaml example for specifying an identifier. (#640)
* Add a yaml example for specifying an identifier. * Update docs
1 parent 498aeba commit 76eb1e8

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

core/serialization.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,16 @@ class Book
642642
}
643643
```
644644

645+
You can also use the YAML configuration format:
646+
647+
```yaml
648+
# api/config/api_platform/resources.yaml
649+
App\Entity\Book:
650+
properties:
651+
id:
652+
identifier: true
653+
```
654+
645655
In some cases, you will want to set the identifier of a resource from the client (e.g. a client-side generated UUID, or a slug).
646656
In such cases, you must make the identifier property a writable class property. Specifically, to use client-generated IDs, you
647657
must do the following:

0 commit comments

Comments
 (0)