@@ -128,61 +128,7 @@ final class BoardGameResource implements ResourceInterface
128128```
129129
130130Note that in that kind of operation, you can disable providing data.
131-
132- ``` php
133- // src/BoardGameBlog/Infrastructure/Sylius/Resource/BoardGameResource.php
134-
135- namespace App\BoardGameBlog\Infrastructure\Sylius\Resource;
136-
137- use Sylius\Resource\Metadata\AsResource;
138- use Sylius\Resource\Metadata\Delete;
139- use Sylius\Resource\Model\ResourceInterface;
140-
141- #[AsResource(
142- alias: 'app.board_game',
143- section: 'admin',
144- formType: BoardGameType::class,
145- templatesDir: 'crud',
146- routePrefix: '/admin',
147- )]
148- #[Delete(
149- processor: DeleteBoardGameProcessor::class,
150- read: false,
151- )]
152- final class BoardGameResource implements ResourceInterface
153- ```
154-
155- But you will also need to adapt your processor.
156-
157- ``` php
158- // src/BoardGameBlog/Infrastructure/Sylius/State/Processor/DeleteBoardGameProcessor.php
159-
160- namespace App\BoardGameBlog\Infrastructure\Sylius\State\Processor;
161-
162- use Sylius\Resource\Context\Option\RequestOption;
163- use Webmozart\Assert\Assert;
164-
165- final class DeleteBoardGameProcessor implements ProcessorInterface
166- {
167- public function __construct(
168- private CommandBusInterface $commandBus,
169- ) {
170- }
171-
172- public function process(mixed $data, Operation $operation, Context $context): mixed
173- {
174- Assert::isInstanceOf($data, BoardGameResource::class);
175-
176- // Data is not provided in this case, so you will need to get it from the HTTP request
177- $id = $context->get(RequestOption::class)?->attributes->get('id') ?? null;
178- Assert::notNull($id);
179-
180- $this->commandBus->dispatch(new DeleteBoardGameCommand(new BoardGameId($id)));
181-
182- return null;
183- }
184- }
185- ```
131+ See [ Disable providing data] ( providers.md#disable-providing-data ) chapter.
186132
187133** [ Go back to the documentation's index] ( index.md ) **
188134
0 commit comments