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 3cd1123

Browse filesBrowse files
committed
minor #37813 [Workflow] Simplify code + Updated README.md (lyrixx)
This PR was merged into the 5.2-dev branch. Discussion ---------- [Workflow] Simplify code + Updated README.md | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | Fix #37539 (cleaning previous PR) | License | MIT | Doc PR | Commits ------- 3268bdb [Workflow] Simplify code + Updated README.md
2 parents 684b04b + 3268bdb commit 3cd1123
Copy full SHA for 3cd1123

File tree

2 files changed

+4
-9
lines changed
Filter options

2 files changed

+4
-9
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Workflow/CHANGELOG.md
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ CHANGELOG
66

77
* Added `Workflow::getEnabledTransition()` to easily retrieve a specific transition object
88
* Added context to the event dispatched
9-
* Added default context to the Initial Marking
9+
* Dispatch an event when the subject enters in the workflow for the very first time
10+
* Added a default context to the previous event
1011

1112
5.1.0
1213
-----

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Workflow/Workflow.php
+2-8Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -396,14 +396,8 @@ private function entered(object $subject, ?Transition $transition, Marking $mark
396396
$this->dispatcher->dispatch($event, WorkflowEvents::ENTERED);
397397
$this->dispatcher->dispatch($event, sprintf('workflow.%s.entered', $this->name));
398398

399-
if ($transition) {
400-
foreach ($transition->getTos() as $place) {
401-
$this->dispatcher->dispatch($event, sprintf('workflow.%s.entered.%s', $this->name, $place));
402-
}
403-
} elseif (!empty($this->definition->getInitialPlaces())) {
404-
foreach ($this->definition->getInitialPlaces() as $place) {
405-
$this->dispatcher->dispatch($event, sprintf('workflow.%s.entered.%s', $this->name, $place));
406-
}
399+
foreach ($marking->getPlaces() as $placeName => $nbToken) {
400+
$this->dispatcher->dispatch($event, sprintf('workflow.%s.entered.%s', $this->name, $placeName));
407401
}
408402
}
409403

0 commit comments

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