ワンクリックで
add-processor
Add custom logic on Create/Update/Delete operations — send an email, dispatch a command, publish an event, push to a queue.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Add custom logic on Create/Update/Delete operations — send an email, dispatch a command, publish an event, push to a queue.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Implement the fix described in a GitHub issue and open a Pull Request that closes it
Apply the latest review feedback to a Pull Request and push it to the PR branch
Add an admin autocomplete form type for a Sylius Resource (translatable or not), optionally injected into another form via an extension
Add an admin FormType for an existing Sylius Resource
Add a Sylius admin grid for an existing Sylius Resource
Add a multiple images collection (OneToMany) to an existing Sylius Resource
| name | add-processor |
| description | Add custom logic on Create/Update/Delete operations — send an email, dispatch a command, publish an event, push to a queue. |
| argument-hint | [ModelName] [Operation] |
| allowed-tools | AskUserQuestion, Bash, Read, Edit, Write, Glob, Grep |
Ask the user if not provided:
ModelName) and the target operation (Create, Update, Delete, BulkDelete, …).{Operation}{ModelName}Processor (e.g. CreateCustomerProcessor).PersistProcessor), decorate for Delete/BulkDelete (keeps RemoveProcessor), full replace for DDD resources not backed by Doctrine.If the user only needs to disable persistence (e.g. a preview operation), do not create a processor — suggest write: false on the operation instead:
new Update(shortName: 'update_preview', write: false)
src/Processor/{ProcessorName}.php — use this when you want the default persistence to still run, and add side effects on top (email, event, queue…):
<?php
declare(strict_types=1);
namespace App\Processor;
use App\Entity\{ModelName};
use Sylius\Resource\Context\Context;
use Sylius\Resource\Doctrine\Common\State\PersistProcessor;
use Sylius\Resource\Metadata\Operation;
use Sylius\Resource\State\ProcessorInterface;
use Webmozart\Assert\Assert;
final class {ProcessorName} implements ProcessorInterface
{
public function __construct(
private PersistProcessor $decorated,
// TODO: inject your side-effect dependencies (Mailer, CommandBus, MessageBus…)
) {
}
public function process(mixed $data, Operation $operation, Context $context): mixed
{
Assert::isInstanceOf($data, {ModelName}::class);
$this->decorated->process($data, $operation, $context);
// TODO: add your business logic (send email, dispatch command, publish event…)
return null;
}
}
For a Delete / BulkDelete operation, replace PersistProcessor with RemoveProcessor:
use Sylius\Resource\Doctrine\Common\State\RemoveProcessor;
public function __construct(
private RemoveProcessor $decorated,
) {}
Use this when the resource is not a Doctrine entity, or you want to bypass the default persistence entirely:
<?php
declare(strict_types=1);
namespace App\Processor;
use App\Entity\{ModelName};
use Sylius\Resource\Context\Context;
use Sylius\Resource\Metadata\Operation;
use Sylius\Resource\State\ProcessorInterface;
use Webmozart\Assert\Assert;
final class {ProcessorName} implements ProcessorInterface
{
public function __construct(
// TODO: inject your dependencies (CommandBus, domain services…)
) {
}
public function process(mixed $data, Operation $operation, Context $context): mixed
{
Assert::isInstanceOf($data, {ModelName}::class);
// TODO: dispatch your command / call your domain service
return null;
}
}
Edit src/Entity/{ModelName}.php:
use App\Processor\{ProcessorName};
new Create(processor: {ProcessorName}::class),
bin/console cache:clear
bin/console sylius:debug:resource 'App\Entity\{ModelName}'
The operation's processor row should display your class FQCN.
/sylius-stack:add-providerread: false on the operation.write: false and no processor is required.