Skip to content

Commit 0a55aca

Browse files
Add doc on api-platform/code#1246
1 parent 2ab4ee6 commit 0a55aca

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

core/default-order.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,29 @@ class Book
5959
}
6060
```
6161

62+
It's also possible to configure the default filter on an association property:
63+
64+
<?php
65+
66+
// src/AppBundle/Entity/Book.php
67+
68+
namespace AppBundle\Entity;
69+
70+
use ApiPlatform\Core\Annotation\ApiResource;
71+
72+
/**
73+
* @ApiResource(attributes={"order"={"author.username"}})
74+
*/
75+
class Book
76+
{
77+
// ...
78+
79+
/**
80+
* @var User
81+
*/
82+
public $author;
83+
}
84+
6285
Previous chapter: [Operations](operations.md)
6386
6487
Next chapter: [Filters](filters.md)

0 commit comments

Comments
 (0)