counter created for workflows for which user is a destuser and that are not finalized

This commit is contained in:
2022-02-01 17:21:49 +01:00
parent de1dddbb85
commit 97d2e3d5b5
4 changed files with 140 additions and 1 deletions

View File

@@ -14,6 +14,7 @@ namespace Chill\MainBundle\Routing\MenuBuilder;
use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Notification\Counter\NotificationByUserCounter;
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
use Chill\MainBundle\Workflow\Counter\WorkflowByUserCounter;
use Symfony\Component\Security\Core\Security;
use Symfony\Contracts\Translation\TranslatorInterface;
@@ -25,12 +26,16 @@ class UserMenuBuilder implements LocalMenuBuilderInterface
private TranslatorInterface $translator;
private WorkflowByUserCounter $workflowByUserCounter;
public function __construct(
NotificationByUserCounter $notificationByUserCounter,
WorkflowByUserCounter $workflowByUserCounter,
Security $security,
TranslatorInterface $translator
) {
$this->notificationByUserCounter = $notificationByUserCounter;
$this->workflowByUserCounter = $workflowByUserCounter;
$this->security = $security;
$this->translator = $translator;
}
@@ -69,9 +74,11 @@ class UserMenuBuilder implements LocalMenuBuilderInterface
'counter' => $nbNotifications,
]);
$workflowCount = $this->workflowByUserCounter->getCountUnreadByUser($user);
$menu
->addChild(
$this->translator->trans('workflow.My workflows'),
$this->translator->trans('workflow.My workflows with counter', ['wc' => $workflowCount]),
['route' => 'chill_main_workflow_list_dest']
)
->setExtras([