@@ -44,12 +44,9 @@ use Symfony\Component\HttpKernel\Attribute\AsController;
4444#[AsController]
4545class CreateBookPublication extends AbstractController
4646{
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+ ) {}
5350
5451 public function __invoke(Book $book): Book
5552 {
@@ -117,14 +114,15 @@ class Book
117114
118115``` yaml
119116# 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
128126` ` `
129127
130128` ` ` xml
@@ -188,14 +186,15 @@ class Book
188186
189187``` yaml
190188# 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
199198` ` `
200199
201200` ` ` xml
@@ -258,15 +257,16 @@ class Book
258257
259258``` yaml
260259# 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']
270270` ` `
271271
272272` ` ` xml
@@ -329,14 +329,15 @@ class Book
329329
330330``` yaml
331331# 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
340341` ` `
341342
342343` ` ` xml
@@ -401,14 +402,15 @@ class Book
401402
402403``` yaml
403404# 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
412414` ` `
413415
414416` ` ` xml
0 commit comments