mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-26 00:24:59 +00:00
Refactor workflow classes and forms
- the workflow controller add a context to each transition; - the state of the entity workflow is applyied using a dedicated marking store - the method EntityWorkflow::step use the context to associate the new step with the future destination user, cc users and email. This makes the step consistent at every step. - this allow to remove some logic which was processed in eventSubscribers, - as counterpart, each workflow must specify a dedicated marking_store: ```yaml framework: workflows: vendee_internal: # ... marking_store: service: Chill\MainBundle\Workflow\EntityWorkflowMarkingStore ```
This commit is contained in:
@@ -23,7 +23,13 @@ use Symfony\Component\Workflow\Registry;
|
||||
|
||||
class NotificationOnTransition implements EventSubscriberInterface
|
||||
{
|
||||
public function __construct(private readonly EntityManagerInterface $entityManager, private readonly \Twig\Environment $engine, private readonly MetadataExtractor $metadataExtractor, private readonly Security $security, private readonly Registry $registry) {}
|
||||
public function __construct(
|
||||
private readonly EntityManagerInterface $entityManager,
|
||||
private readonly \Twig\Environment $engine,
|
||||
private readonly MetadataExtractor $metadataExtractor,
|
||||
private readonly Security $security,
|
||||
private readonly Registry $registry
|
||||
) {}
|
||||
|
||||
public static function getSubscribedEvents(): array
|
||||
{
|
||||
@@ -85,7 +91,10 @@ class NotificationOnTransition implements EventSubscriberInterface
|
||||
'dest' => $subscriber,
|
||||
'place' => $place,
|
||||
'workflow' => $workflow,
|
||||
'is_dest' => \in_array($subscriber->getId(), array_map(static fn (User $u) => $u->getId(), $entityWorkflow->futureDestUsers), true),
|
||||
'is_dest' => \in_array($subscriber->getId(), array_map(
|
||||
static fn (User $u) => $u->getId(),
|
||||
$entityWorkflow->getCurrentStep()->getDestUser()->toArray()
|
||||
), true),
|
||||
];
|
||||
|
||||
$notification = new Notification();
|
||||
|
Reference in New Issue
Block a user