CodeExplorer shouldDispatchEvent example
$this->dispatcher->
dispatch($event, WorkflowEvents::GUARD
);
$this->dispatcher->
dispatch($event,
sprintf('workflow.%s.guard',
$this->name
));
$this->dispatcher->
dispatch($event,
sprintf('workflow.%s.guard.%s',
$this->name,
$transition->
getName()));
return $event;
} private function leave(object
$subject, Transition
$transition, Marking
$marking, array
$context =
[]): void
{ $places =
$transition->
getFroms();
if ($this->
shouldDispatchEvent(WorkflowEvents::LEAVE,
$context)) { $event =
new LeaveEvent($subject,
$marking,
$transition,
$this,
$context);
$this->dispatcher->
dispatch($event, WorkflowEvents::LEAVE
);
$this->dispatcher->
dispatch($event,
sprintf('workflow.%s.leave',
$this->name
));
foreach ($places as $place) { $this->dispatcher->
dispatch($event,
sprintf('workflow.%s.leave.%s',
$this->name,
$place));
} } foreach ($places as $place) {