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..0e47d4a9a0 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')); 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", 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') =]] ```