From f4d23737a9af94c4bb0668f969166bf30d4bff3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Noco=C5=84?= Date: Mon, 22 Sep 2025 14:12:42 +0200 Subject: [PATCH 1/4] [Composer] Added missing ibexa/messenger package --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 734baa69ba..512fdac995 100644 --- a/composer.json +++ b/composer.json @@ -71,7 +71,8 @@ "ibexa/tree-builder": "~4.6.x-dev", "ibexa/discounts": "~4.6.x-dev", "ibexa/discounts-codes": "~4.6.x-dev", - "ibexa/product-catalog-symbol-attribute": "~4.6.x-dev" + "ibexa/product-catalog-symbol-attribute": "~4.6.x-dev", + "ibexa/messenger": "~4.6.x-dev" }, "scripts": { "fix-cs": "php-cs-fixer fix --config=.php-cs-fixer.php -v --show-progress=dots", From 8844ff20fe3e0e4ffcdccabc23086ff0e7be5f54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Noco=C5=84?= Date: Mon, 22 Sep 2025 14:13:15 +0200 Subject: [PATCH 2/4] Adjusted code samples for Notifications --- .../notifications/src/Notification/ListRenderer.php | 6 +++++- .../notifications/src/Notification/MyRenderer.php | 10 ++++++---- code_samples/notifications/Src/Query/search.php | 8 +++++--- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/code_samples/back_office/notifications/src/Notification/ListRenderer.php b/code_samples/back_office/notifications/src/Notification/ListRenderer.php index ced5b5dd1d..1c4eb18d20 100644 --- a/code_samples/back_office/notifications/src/Notification/ListRenderer.php +++ b/code_samples/back_office/notifications/src/Notification/ListRenderer.php @@ -9,6 +9,7 @@ use Ibexa\Core\Notification\Renderer\TypedNotificationRendererInterface; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\Routing\RouterInterface; +use Symfony\Contracts\Translation\TranslatorInterface; use Twig\Environment; class ListRenderer implements NotificationRenderer, TypedNotificationRendererInterface @@ -19,11 +20,14 @@ class ListRenderer implements NotificationRenderer, TypedNotificationRendererInt protected RequestStack $requestStack; - public function __construct(Environment $twig, RouterInterface $router, RequestStack $requestStack) + protected TranslatorInterface $translator; + + public function __construct(Environment $twig, RouterInterface $router, RequestStack $requestStack, TranslatorInterface $translator) { $this->twig = $twig; $this->router = $router; $this->requestStack = $requestStack; + $this->translator = $translator; } public function render(Notification $notification): string diff --git a/code_samples/back_office/notifications/src/Notification/MyRenderer.php b/code_samples/back_office/notifications/src/Notification/MyRenderer.php index f7cde2eeb6..6c932e960a 100644 --- a/code_samples/back_office/notifications/src/Notification/MyRenderer.php +++ b/code_samples/back_office/notifications/src/Notification/MyRenderer.php @@ -8,6 +8,7 @@ use Ibexa\Core\Notification\Renderer\NotificationRenderer; use Ibexa\Core\Notification\Renderer\TypedNotificationRendererInterface; use Symfony\Component\Routing\RouterInterface; +use Symfony\Contracts\Translation\TranslatorInterface; use Twig\Environment; class MyRenderer implements NotificationRenderer, TypedNotificationRendererInterface @@ -16,17 +17,20 @@ class MyRenderer implements NotificationRenderer, TypedNotificationRendererInter protected RouterInterface $router; - public function __construct(Environment $twig, RouterInterface $router) + protected TranslatorInterface $translator; + + public function __construct(Environment $twig, RouterInterface $router, TranslatorInterface $translator) { $this->twig = $twig; $this->router = $router; + $this->translator = $translator; } public function render(Notification $notification): string { return $this->twig->render('@ibexadesign/notification.html.twig', [ 'notification' => $notification, - 'template_to_extend' => $templateToExtend, + 'template_to_extend' => '@ibexadesign/account/notifications/list_item.html.twig', ]); } @@ -39,8 +43,6 @@ public function generateUrl(Notification $notification): ?string return null; } - } - public function getTypeLabel(): string { return /** @Desc("Workflow stage changed") */ diff --git a/code_samples/notifications/Src/Query/search.php b/code_samples/notifications/Src/Query/search.php index d771b8b343..f7f0e4e2d2 100644 --- a/code_samples/notifications/Src/Query/search.php +++ b/code_samples/notifications/Src/Query/search.php @@ -2,10 +2,12 @@ declare(strict_types=1); -use Ibexa\Contracts\Core\Repository\Values\NotificationQuery; +use Ibexa\Contracts\Core\Repository\Values\Notification\Query\Criterion\DateCreated; +use Ibexa\Contracts\Core\Repository\Values\Notification\Query\Criterion\Status; +use Ibexa\Contracts\Core\Repository\Values\Notification\Query\Criterion\Type; +use Ibexa\Contracts\Core\Repository\Values\Notification\Query\NotificationQuery; -$repository = $this->getRepository(); -$notificationService = $repository->getNotificationService(); +/** @var \Ibexa\Contracts\Core\Repository\NotificationService $notificationService */ $query = new NotificationQuery([], 0, 25); $query->addCriterion(new Type('Workflow:Review')); From ced143085cecfc7cd376a0aff118d09c9809bd5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Noco=C5=84?= Date: Mon, 22 Sep 2025 14:16:37 +0200 Subject: [PATCH 3/4] Adjusted code sample usage --- .../criteria_reference/notification_datecreated_criterion.md | 2 +- docs/search/criteria_reference/notification_status_criterion.md | 2 +- docs/search/criteria_reference/notification_type_criterion.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/search/criteria_reference/notification_datecreated_criterion.md b/docs/search/criteria_reference/notification_datecreated_criterion.md index 94066f4bd1..051d0c721d 100644 --- a/docs/search/criteria_reference/notification_datecreated_criterion.md +++ b/docs/search/criteria_reference/notification_datecreated_criterion.md @@ -16,6 +16,6 @@ The `DateCreated` Search Criterion searches for notifications based on the date ### PHP -```php hl_lines="14-15 17" +```php hl_lines="16-17 19" [[= include_file('code_samples/notifications/Src/Query/search.php') =]] ``` diff --git a/docs/search/criteria_reference/notification_status_criterion.md b/docs/search/criteria_reference/notification_status_criterion.md index f3f747cb34..9abc1eca7f 100644 --- a/docs/search/criteria_reference/notification_status_criterion.md +++ b/docs/search/criteria_reference/notification_status_criterion.md @@ -15,6 +15,6 @@ The `Status` Search Criterion searches for notifications based on notification s ### PHP -```php hl_lines="12" +```php hl_lines="14" [[= include_file('code_samples/notifications/Src/Query/search.php') =]] ``` diff --git a/docs/search/criteria_reference/notification_type_criterion.md b/docs/search/criteria_reference/notification_type_criterion.md index 076e2b4064..411bf1a269 100644 --- a/docs/search/criteria_reference/notification_type_criterion.md +++ b/docs/search/criteria_reference/notification_type_criterion.md @@ -15,6 +15,6 @@ The `Type` Search Criterion searches for notifications by their types. ### PHP -```php hl_lines="11" +```php hl_lines="13" [[= include_file('code_samples/notifications/Src/Query/search.php') =]] ``` From 2ef9410613df643a922e1a0d262ff1de42b8f311 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Noco=C5=84?= Date: Mon, 22 Sep 2025 14:51:12 +0200 Subject: [PATCH 4/4] Fixed too many spaces --- code_samples/notifications/Src/Query/search.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code_samples/notifications/Src/Query/search.php b/code_samples/notifications/Src/Query/search.php index f7f0e4e2d2..0e47d4a9a0 100644 --- a/code_samples/notifications/Src/Query/search.php +++ b/code_samples/notifications/Src/Query/search.php @@ -3,9 +3,9 @@ declare(strict_types=1); use Ibexa\Contracts\Core\Repository\Values\Notification\Query\Criterion\DateCreated; -use Ibexa\Contracts\Core\Repository\Values\Notification\Query\Criterion\Status; -use Ibexa\Contracts\Core\Repository\Values\Notification\Query\Criterion\Type; -use Ibexa\Contracts\Core\Repository\Values\Notification\Query\NotificationQuery; +use Ibexa\Contracts\Core\Repository\Values\Notification\Query\Criterion\Status; +use Ibexa\Contracts\Core\Repository\Values\Notification\Query\Criterion\Type; +use Ibexa\Contracts\Core\Repository\Values\Notification\Query\NotificationQuery; /** @var \Ibexa\Contracts\Core\Repository\NotificationService $notificationService */ $query = new NotificationQuery([], 0, 25);