private function announce(object
$subject, Transition
$initialTransition, Marking
$marking, array
$context): void
{ if (!
$this->
shouldDispatchEvent(WorkflowEvents::ANNOUNCE,
$context)) { return;
} $event =
new AnnounceEvent($subject,
$marking,
$initialTransition,
$this,
$context);
$this->dispatcher->
dispatch($event, WorkflowEvents::ANNOUNCE
);
$this->dispatcher->
dispatch($event,
sprintf('workflow.%s.announce',
$this->name
));
foreach ($this->
getEnabledTransitions($subject) as $transition) { $this->dispatcher->
dispatch($event,
sprintf('workflow.%s.announce.%s',
$this->name,
$transition->
getName()));
} } private function shouldDispatchEvent(string
$eventName, array
$context): bool
{ if (null ===
$this->dispatcher
) { return false;
} if ($context[self::DISABLE_EVENTS_MAPPING
[$eventName]] ?? false
) {