File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -39,7 +39,9 @@ Create the following file structure:
3939├── bootstrap.php
4040├── composer.json
4141└── src/
42- └── Book.php
42+ ├── Book.php
43+ ├── BookProcessor.php
44+ └── BookProvider.php
4345```
4446
4547Create ` src/Book.php ` :
@@ -50,17 +52,25 @@ Create `src/Book.php`:
5052namespace App;
5153
5254use ApiPlatform\Metadata\ApiResource;
53- use ApiPlatform\Metadata\CollectionOperationInterface;
54- use ApiPlatform\Metadata\Operation;
55- use ApiPlatform\State\ProcessorInterface;
56- use ApiPlatform\State\ProviderInterface;
5755
5856#[ApiResource(provider: BookProvider::class, processor: BookProcessor::class)]
5957class Book
6058{
6159 public int $id;
6260 public string $title = '';
6361}
62+ ```
63+
64+ Create ` src/BookProvider.php ` :
65+
66+ ``` php
67+ <?php
68+
69+ namespace App;
70+
71+ use ApiPlatform\Metadata\CollectionOperationInterface;
72+ use ApiPlatform\Metadata\Operation;
73+ use ApiPlatform\State\ProviderInterface;
6474
6575class BookProvider implements ProviderInterface
6676{
@@ -84,6 +94,17 @@ class BookProvider implements ProviderInterface
8494 return $book;
8595 }
8696}
97+ ```
98+
99+ Create ` src/BookProcessor.php ` :
100+
101+ ``` php
102+ <?php
103+
104+ namespace App;
105+
106+ use ApiPlatform\Metadata\Operation;
107+ use ApiPlatform\State\ProcessorInterface;
87108
88109class BookProcessor implements ProcessorInterface
89110{
You can’t perform that action at this time.
0 commit comments