[Workflow] Added more events to the announce function

This commit is contained in:
Tobias Nyholm 2017-06-25 20:04:17 +02:00 committed by Grégoire Pineau
parent 59094b406a
commit c5042f35e1
2 changed files with 5 additions and 0 deletions

View File

@ -259,6 +259,8 @@ class WorkflowTest extends TestCase
'workflow.workflow_name.enter.b',
'workflow.workflow_name.enter.c',
// Following events are fired because of announce() method
'workflow.announce',
'workflow.workflow_name.announce',
'workflow.guard',
'workflow.workflow_name.guard',
'workflow.workflow_name.guard.t2',

View File

@ -282,6 +282,9 @@ class Workflow
$event = new Event($subject, $marking, $initialTransition);
$this->dispatcher->dispatch('workflow.announce', $event);
$this->dispatcher->dispatch(sprintf('workflow.%s.announce', $this->name), $event);
foreach ($this->getEnabledTransitions($subject) as $transition) {
$this->dispatcher->dispatch(sprintf('workflow.%s.announce.%s', $this->name, $transition->getName()), $event);
}