mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-29 19:13:49 +00:00
Add support for handling user groups in workflow counters and list workflows in "my workflows" controller
- rewrite queries in repositories; - fix cache key cleaning for members of users when a workflow is transitionned
This commit is contained in:
@@ -12,6 +12,7 @@ declare(strict_types=1);
|
||||
namespace Chill\MainBundle\Workflow\Counter;
|
||||
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use Chill\MainBundle\Entity\UserGroup;
|
||||
use Chill\MainBundle\Entity\Workflow\EntityWorkflow;
|
||||
use Chill\MainBundle\Repository\Workflow\EntityWorkflowStepRepository;
|
||||
use Chill\MainBundle\Templating\UI\NotificationCounterInterface;
|
||||
@@ -82,6 +83,18 @@ final readonly class WorkflowByUserCounter implements NotificationCounterInterfa
|
||||
foreach ($step->getDestUser() as $user) {
|
||||
$keys[] = self::generateCacheKeyWorkflowByUser($user);
|
||||
}
|
||||
foreach ($step->getDestUserGroups()->reduce(
|
||||
function (array $accumulator, UserGroup $userGroup) {
|
||||
foreach ($userGroup->getUsers() as $user) {
|
||||
$accumulator[] = $user;
|
||||
}
|
||||
|
||||
return $accumulator;
|
||||
},
|
||||
[]
|
||||
) as $user) {
|
||||
$keys[] = self::generateCacheKeyWorkflowByUser($user);
|
||||
}
|
||||
|
||||
if ([] !== $keys) {
|
||||
$this->cacheItemPool->deleteItems($keys);
|
||||
|
Reference in New Issue
Block a user