Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d00a4aa

Browse filesBrowse files
izzyplyrixx
authored andcommitted
Update WorkflowTest.php
1 parent 266d9d3 commit d00a4aa
Copy full SHA for d00a4aa

File tree

3 files changed

+19
-0
lines changed
Filter options

3 files changed

+19
-0
lines changed

‎src/Symfony/Component/Workflow/CHANGELOG.md

Copy file name to clipboardExpand all lines: src/Symfony/Component/Workflow/CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ CHANGELOG
55
-----
66

77
* Added support for `Event::getWorkflowName()` for "announce" events.
8+
* Added `workflow.completed` events which are fired after a transition is completed.
89

910
3.3.0
1011
-----

‎src/Symfony/Component/Workflow/Tests/WorkflowTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Workflow/Tests/WorkflowTest.php
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,9 @@ public function testApplyWithEventDispatcher()
287287
'workflow.workflow_name.entered',
288288
'workflow.workflow_name.entered.b',
289289
'workflow.workflow_name.entered.c',
290+
'workflow.completed',
291+
'workflow.workflow_name.completed',
292+
'workflow.workflow_name.completed.t1',
290293
// Following events are fired because of announce() method
291294
'workflow.announce',
292295
'workflow.workflow_name.announce',

‎src/Symfony/Component/Workflow/Workflow.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Workflow/Workflow.php
+15Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@ public function apply($subject, $transitionName)
151151

152152
$this->entered($subject, $transition, $marking);
153153

154+
$this->completed($subject, $transition, $marking);
155+
154156
$this->announce($subject, $transition, $marking);
155157
}
156158

@@ -309,6 +311,19 @@ private function entered($subject, Transition $transition, Marking $marking)
309311
}
310312
}
311313

314+
private function completed($subject, Transition $transition, Marking $marking)
315+
{
316+
if (null === $this->dispatcher) {
317+
return;
318+
}
319+
320+
$event = new Event($subject, $marking, $transition, $this->name);
321+
322+
$this->dispatcher->dispatch('workflow.completed', $event);
323+
$this->dispatcher->dispatch(sprintf('workflow.%s.completed', $this->name), $event);
324+
$this->dispatcher->dispatch(sprintf('workflow.%s.completed.%s', $this->name, $transition->getName()), $event);
325+
}
326+
312327
private function announce($subject, Transition $initialTransition, Marking $marking)
313328
{
314329
if (null === $this->dispatcher) {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.