You can add your own custom handlers using the following configuration :
pending_actions:
handlers:
MyHandlerLabel: my_handler_service_id
MySecondHandlerLabel: my_second_handler_service_id
You can then register a PendingAction with your custom handler using the following code :
<?php
$params = [];
$this
->get("cn_pending_actions.pending_actions_service")
->register(
"MyHandlerLabel",
$params,
"my_group_label"
);
Requirements
- The handler has to be registered as a service
- The service class has to implement the interface
\ClaviculaNox\PendingActionsBundle\Classes\Interfaces\HandlerInterface
Interface Documentation
The Interface has 2 methods :
- checkPendingAction : Used to check if the PendingAction can be processed. Returns true if the PendingAction can be processed, false otherwise.
- process : Used to process the PendingAction. Returns a PendingAction state, depending on the result.