@@ -44,12 +44,9 @@ use Symfony\Component\HttpKernel\Attribute\AsController;
44
44
#[AsController]
45
45
class CreateBookPublication extends AbstractController
46
46
{
47
- private $bookPublishingHandler;
48
-
49
- public function __construct(BookPublishingHandler $bookPublishingHandler)
50
- {
51
- $this->bookPublishingHandler = $bookPublishingHandler;
52
- }
47
+ public function __construct(
48
+ private BookPublishingHandler $bookPublishingHandler
49
+ ) {}
53
50
54
51
public function __invoke(Book $book): Book
55
52
{
@@ -117,14 +114,15 @@ class Book
117
114
118
115
``` yaml
119
116
# api/config/api_platform/resources.yaml
120
- App\Entity\Book :
121
- operations :
122
- ApiPlatform\Metadata\Get : ~
123
- post_publication :
124
- class : ApiPlatform\Metadata\Post
125
- method : POST
126
- uriTemplate : /books/{id}/publication
127
- controller : App\Controller\CreateBookPublication
117
+ resources :
118
+ App\Entity\Book :
119
+ operations :
120
+ ApiPlatform\Metadata\Get : ~
121
+ post_publication :
122
+ class : ApiPlatform\Metadata\Post
123
+ method : POST
124
+ uriTemplate : /books/{id}/publication
125
+ controller : App\Controller\CreateBookPublication
128
126
` ` `
129
127
130
128
` ` ` xml
@@ -188,14 +186,15 @@ class Book
188
186
189
187
``` yaml
190
188
# api/config/api_platform/resources.yaml
191
- App\Entity\Book :
192
- operations :
193
- ApiPlatform\Metadata\Get : ~
194
- post_publication :
195
- class : ApiPlatform\Metadata\Post
196
- method : POST
197
- uriTemplate : /books/{id}/publication
198
- controller : ApiPlatform\Action\PlaceholderAction
189
+ resources :
190
+ App\Entity\Book :
191
+ operations :
192
+ ApiPlatform\Metadata\Get : ~
193
+ post_publication :
194
+ class : ApiPlatform\Metadata\Post
195
+ method : POST
196
+ uriTemplate : /books/{id}/publication
197
+ controller : ApiPlatform\Action\PlaceholderAction
199
198
` ` `
200
199
201
200
` ` ` xml
@@ -258,15 +257,16 @@ class Book
258
257
259
258
``` yaml
260
259
# api/config/api_platform/resources.yaml
261
- App\Entity\Book :
262
- operations :
263
- ApiPlatform\Metadata\Get : ~
264
- post_publication :
265
- class : ApiPlatform\Metadata\Get
266
- uriTemplate : /books/{id}/publication
267
- controller : App\Controller\CreateBookPublication
268
- normalizationContext :
269
- groups : ['publication']
260
+ resources :
261
+ App\Entity\Book :
262
+ operations :
263
+ ApiPlatform\Metadata\Get : ~
264
+ post_publication :
265
+ class : ApiPlatform\Metadata\Get
266
+ uriTemplate : /books/{id}/publication
267
+ controller : App\Controller\CreateBookPublication
268
+ normalizationContext :
269
+ groups : ['publication']
270
270
` ` `
271
271
272
272
` ` ` xml
@@ -329,14 +329,15 @@ class Book
329
329
330
330
``` yaml
331
331
# api/config/api_platform/resources.yaml
332
- App\Entity\Book :
333
- operations :
334
- ApiPlatform\Metadata\Get : ~
335
- post_publication :
336
- class : ApiPlatform\Metadata\Post
337
- uriTemplate : /books/{id}/publication
338
- controller : App\Controller\CreateBookPublication
339
- read : false
332
+ resources :
333
+ App\Entity\Book :
334
+ operations :
335
+ ApiPlatform\Metadata\Get : ~
336
+ post_publication :
337
+ class : ApiPlatform\Metadata\Post
338
+ uriTemplate : /books/{id}/publication
339
+ controller : App\Controller\CreateBookPublication
340
+ read : false
340
341
` ` `
341
342
342
343
` ` ` xml
@@ -401,14 +402,15 @@ class Book
401
402
402
403
``` yaml
403
404
# api/config/api_platform/resources.yaml
404
- App\Entity\Book :
405
- operations :
406
- ApiPlatform\Metadata\Get : ~
407
- post_publication :
408
- class : ApiPlatform\Metadata\Post
409
- routeName : book_post_publication
410
- book_post_discontinuation :
411
- class : ApiPlatform\Metadata\Post
405
+ resources :
406
+ App\Entity\Book :
407
+ operations :
408
+ ApiPlatform\Metadata\Get : ~
409
+ post_publication :
410
+ class : ApiPlatform\Metadata\Post
411
+ routeName : book_post_publication
412
+ book_post_discontinuation :
413
+ class : ApiPlatform\Metadata\Post
412
414
` ` `
413
415
414
416
` ` ` xml
0 commit comments