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: admin/handling-relations-to-collections.md
+16-15Lines changed: 16 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,9 @@
1
1
# Handling Relations to Collections
2
2
3
-
Currently, API Platform Admin doesn't handle `to-many` relations. The core library [is being patched](https://github.com/api-platform/core/pull/1189)
4
-
to document relations to collections through OWL.
5
-
6
-
Meanwhile, it is possible to manually configure API Platform to handle relations to collections.
7
-
8
-
We will create the admin for an API exposing `Person` and `Book` resources linked with a `many-to-many`
3
+
Considering an API exposing `Person` and `Book` resources linked with a `many-to-many`
9
4
relation between them (through the `authors` property).
10
5
11
-
This API can be created using the following PHP code:
6
+
This API using the following PHP code:
12
7
13
8
```php
14
9
<?php
@@ -74,22 +69,29 @@ class Book
74
69
}
75
70
```
76
71
77
-
Let's customize the components used for the `authors` property:
72
+
The admin handles this `to-many` relation automatically!
73
+
74
+
But we can go further:
75
+
76
+
77
+
## Customizing a property
78
+
79
+
Let's customize the components used for the `authors` property, to display them by their 'name' instead 'id' (the default behavior).
0 commit comments