diff --git a/code_samples/background_tasks/src/Dispatcher/SomeClassThatSchedulesExecutionInTheBackground.php b/code_samples/background_tasks/src/Dispatcher/SomeClassThatSchedulesExecutionInTheBackground.php deleted file mode 100644 index af4039f8aa..0000000000 --- a/code_samples/background_tasks/src/Dispatcher/SomeClassThatSchedulesExecutionInTheBackground.php +++ /dev/null @@ -1,31 +0,0 @@ -bus->dispatch(new SomeMessage()); - - $currentUserId = $this->permissionResolver->getCurrentUserReference()->getUserId(); - $this->bus->dispatch(new SomeMessage(), [new UserPermissionStamp($currentUserId)]); - $this->bus->dispatch(new SomeMessage(), [new SudoStamp()]); - - $deduplicationKey = 'my_message.project.'; - $this->bus->dispatch(new SomeMessage(), [new DeduplicateStamp($deduplicationKey)]); - } -} diff --git a/docs/infrastructure_and_maintenance/background_tasks.md b/docs/infrastructure_and_maintenance/background_tasks.md index cc5f5bc567..534832b4d8 100644 --- a/docs/infrastructure_and_maintenance/background_tasks.md +++ b/docs/infrastructure_and_maintenance/background_tasks.md @@ -114,12 +114,25 @@ services: ``` ``` php -[[= include_code('code_samples/background_tasks/src/Dispatcher/SomeClassThatSchedulesExecutionInTheBackground.php', 1, 3) =]] +bus->dispatch(new SomeMessage()); + } +} ``` 3\. [Route the message to the background queue](#route-message-to-background-queue). @@ -154,10 +167,12 @@ On top of the supported Symfony stamps, [[= product_name =]] provides the follow The following example shows how you can attach the `SudoStamp` to the message: ``` php -[[= include_code('code_samples/background_tasks/src/Dispatcher/SomeClassThatSchedulesExecutionInTheBackground.php', 7, 7, remove_indent=True) =]] -[[= include_code('code_samples/background_tasks/src/Dispatcher/SomeClassThatSchedulesExecutionInTheBackground.php', 9, 10, remove_indent=True) =]] +use App\Message\SomeMessage; +use Ibexa\Contracts\Messenger\Stamp\SudoStamp; +use Symfony\Component\Messenger\MessageBusInterface; -[[= include_code('code_samples/background_tasks/src/Dispatcher/SomeClassThatSchedulesExecutionInTheBackground.php', 25, 25, remove_indent=True) =]] +/** @var MessageBusInterface $bus */ +$bus->dispatch(new SomeMessage(), [new SudoStamp()]); ``` #### UserPermissionStamp @@ -171,10 +186,16 @@ By combing this stamp with [`SudoStamp`](#sudostamp), you can set the repository The following example shows how you can use `UserPermissionStamp` to preserve the current repository user after the message is dispatched. ``` php -[[= include_code('code_samples/background_tasks/src/Dispatcher/SomeClassThatSchedulesExecutionInTheBackground.php', 5, 5, remove_indent=True) =]] -[[= include_code('code_samples/background_tasks/src/Dispatcher/SomeClassThatSchedulesExecutionInTheBackground.php', 8, 10, remove_indent=True) =]] +use App\Message\SomeMessage; +use Ibexa\Contracts\Core\Repository\PermissionResolver; +use Ibexa\Contracts\Messenger\Stamp\UserPermissionStamp; +use Symfony\Component\Messenger\MessageBusInterface; + +/** @var PermissionResolver $permissionResolver */ +$currentUserId = $permissionResolver->getCurrentUserReference()->getUserId(); -[[= include_code('code_samples/background_tasks/src/Dispatcher/SomeClassThatSchedulesExecutionInTheBackground.php', 23, 24, remove_indent=True) =]] +/** @var MessageBusInterface $bus */ +$bus->dispatch(new SomeMessage(), [new UserPermissionStamp($currentUserId)]); ``` #### SiteAccessStamp diff --git a/docs/raptor_cdp/raptor_cdp_data_customization.md b/docs/raptor_cdp/raptor_cdp_data_customization.md index c4755bc5ee..af390636c0 100644 --- a/docs/raptor_cdp/raptor_cdp_data_customization.md +++ b/docs/raptor_cdp/raptor_cdp_data_customization.md @@ -26,6 +26,8 @@ The following example adds a custom date of birth field to the exported data: Register your processor as a Symfony service and tag it with `ibexa.cdp.export.user.item_processor`: ``` yaml +services: + App\Export\User\DateOfBirthUserItemProcessor: parent: Ibexa\Contracts\Cdp\Export\User\AbstractUserItemProcessor arguments: diff --git a/tests/yaml-validation-baseline.yaml b/tests/yaml-validation-baseline.yaml index a10ad5c032..da912104b8 100644 --- a/tests/yaml-validation-baseline.yaml +++ b/tests/yaml-validation-baseline.yaml @@ -32,11 +32,6 @@ ignoreErrors: line: 26 hash: 4cfc5ac559eb8db38edb6c8a29872883a95886b61cdae2b343a5ebaf4a9bca8e message: '~The value "\" is not allowed for path "ibexa\.system\.\\>\.product_tour\.\\.type"\. Permissible values\: "general", "targetable"\.~' - - - path: docs/cdp/cdp_data_customization.md - line: 29 - hash: bb2ecc0b96ca61cd004b9c1806e78d6afc3197a68acb723db7a52cfd5bdc89d6 - message: '~Unable to parse at line 1 \(near " App\\Export\\User\\DateOfBirthUserItemProcessor\:"\)\.~' - path: docs/commerce/checkout/customize_checkout.md line: 130 @@ -349,7 +344,7 @@ ignoreErrors: message: '~Unrecognized option "require_previous_session" under "security\.firewalls\.ezpublish_front\.form_login"\. Available options are "always_use_default_target_path", "check_path", "csrf_parameter", "csrf_token_id", "default_target_path", "enable_csrf", "failure_forward", "failure_handler", "failure_path", "failure_path_parameter", "form_only", "login_path", "password_parameter", "post_only", "provider", "remember_me", "success_handler", "target_path_parameter", "use_forward", "use_referer", "username_parameter"\.~' - path: docs/release_notes/ibexa_dxp_v5.0.md - line: 85 + line: 84 hash: 7d4a5637a3e036ebcdc5a4be8282aebe2bfcbaee3222981b81f739ae773111d0 message: '~The child config "path" under "ibexa\.repositories\.\\.mcp\.\" must be configured\: MCP server path~' -