@@ -127,7 +127,7 @@ use Sylius\Resource\Model\ResourceInterface;
127127final class BoardGameResource implements ResourceInterface
128128```
129129
130- Note that in this case , you can disable providing data.
130+ Note that in that kind of operation , you can disable providing data.
131131
132132``` php
133133// src/BoardGameBlog/Infrastructure/Sylius/Resource/BoardGameResource.php
@@ -152,6 +152,38 @@ use Sylius\Resource\Model\ResourceInterface;
152152final class BoardGameResource implements ResourceInterface
153153```
154154
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+ ```
186+
155187** [ Go back to the documentation's index] ( index.md ) **
156188
157189** [ > Next chapter: Responders] ( responders.md ) **
0 commit comments