mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-29 19:13:49 +00:00
Send a notification to all User which are members of UserGroups, when a workflow is sent to them
This commit is contained in:
@@ -13,6 +13,7 @@ namespace Chill\MainBundle\Workflow\EventSubscriber;
|
||||
|
||||
use Chill\MainBundle\Entity\Notification;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use Chill\MainBundle\Entity\UserGroup;
|
||||
use Chill\MainBundle\Entity\Workflow\EntityWorkflow;
|
||||
use Chill\MainBundle\Workflow\Helper\MetadataExtractor;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
@@ -69,7 +70,18 @@ class NotificationOnTransition implements EventSubscriberInterface
|
||||
// the dests for the current step
|
||||
$entityWorkflow->getCurrentStep()->getDestUser()->toArray(),
|
||||
// the cc users for the current step
|
||||
$entityWorkflow->getCurrentStep()->getCcUser()->toArray()
|
||||
$entityWorkflow->getCurrentStep()->getCcUser()->toArray(),
|
||||
// the users within groups
|
||||
$entityWorkflow->getCurrentStep()->getDestUserGroups()->reduce(
|
||||
function (array $accumulator, UserGroup $userGroup) {
|
||||
foreach ($userGroup->getUsers() as $user) {
|
||||
$accumulator[] = $user;
|
||||
}
|
||||
|
||||
return $accumulator;
|
||||
},
|
||||
[]
|
||||
),
|
||||
) as $dest) {
|
||||
$dests[spl_object_hash($dest)] = $dest;
|
||||
}
|
||||
|
Reference in New Issue
Block a user