@@ -9,8 +9,8 @@ customize this order, you must add an `order` attribute on your ApiResource anno
9
9
10
10
``` php
11
11
<?php
12
- // api/src/Entity /Book.php
13
- namespace App\Entity ;
12
+ // api/src/ApiResource /Book.php with Symfony or app/ApiResource/Book.php with Laravel
13
+ namespace App\ApiResource ;
14
14
15
15
use ApiPlatform\Metadata\ApiResource;
16
16
@@ -30,7 +30,8 @@ class Book
30
30
31
31
``` yaml
32
32
# api/config/api_platform/resources/Book.yaml
33
- App\Entity\Book :
33
+ # The YAML syntax is only supported for Symfony
34
+ App\ApiResource\Book :
34
35
order :
35
36
foo : ASC
36
37
` ` `
@@ -44,8 +45,8 @@ If you only specify the key, `ASC` direction will be used as default. For exampl
44
45
45
46
` ` ` php
46
47
<?php
47
- // api/src/Entity /Book.php
48
- namespace App\E ntity ;
48
+ // api/src/ApiResource /Book.php with Symfony or app/ApiResource/Book.php with Laravel
49
+ namespace App\A piResource ;
49
50
50
51
use ApiPlatform\M etadata\A piResource;
51
52
@@ -70,7 +71,8 @@ class Book
70
71
71
72
` ` ` yaml
72
73
# api/config/api_platform/resources/Book.yaml
73
- App\E ntity\B ook:
74
+ # The YAML syntax is only supported for Symfony
75
+ App\A piResource\B ook:
74
76
order: ['foo', 'bar']
75
77
` ` `
76
78
@@ -82,8 +84,8 @@ It's also possible to configure the default order on an association property:
82
84
83
85
` ` ` php
84
86
<?php
85
- // api/src/Entity /Book.php
86
- namespace App\E ntity ;
87
+ // api/src/ApiResource /Book.php with Symfony or app/ApiResource/Book.php with Laravel
88
+ namespace App\A piResource ;
87
89
88
90
use ApiPlatform\M etadata\A piResource;
89
91
@@ -103,7 +105,8 @@ class Book
103
105
104
106
` ` ` yaml
105
107
# api/config/api_platform/resources/Book.yaml
106
- App\E ntity\B ook:
108
+ # The YAML syntax is only supported for Symfony
109
+ App\A piResource\B ook:
107
110
order: ['author.username']
108
111
` ` `
109
112
@@ -115,8 +118,8 @@ Another possibility is to apply the default order for a specific collection oper
115
118
116
119
` ` ` php
117
120
<?php
118
- // api/src/Entity /Book.php
119
- namespace App\E ntity ;
121
+ // api/src/ApiResource /Book.php with Symfony or app/ApiResource/Book.php with Laravel
122
+ namespace App\A piResource ;
120
123
121
124
use ApiPlatform\M etadata\G etCollection;
122
125
use ApiPlatform\M etadata\A piResource;
@@ -141,7 +144,8 @@ class Book
141
144
142
145
` ` ` yaml
143
146
# api/config/api_platform/resources/Book.yaml
144
- App\E ntity\B ook:
147
+ # The YAML syntax is only supported for Symfony
148
+ App\A piResource\B ook:
145
149
ApiPlatform\M etadata\G etCollection: ~
146
150
get_desc_custom:
147
151
class: ApiPlatform\M etadata\G etCollection
0 commit comments