Skip to content

Commit c1ffe3d

Browse files
committed
[Workflow] Deprecate Event::getWorkflow() method
1 parent a2cdf06 commit c1ffe3d

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
CHANGELOG
22
=========
33

4+
7.3
5+
---
6+
7+
* Deprecate `Event::getWorkflow()` method
8+
49
7.1
510
---
611

712
* Add method `getEnabledTransition()` to `WorkflowInterface`
813
* Automatically register places from transitions
914
* Add support for workflows that need to store many tokens in the marking
10-
* Add method `getName()` in event classes to build event names in subscribers
15+
* Add method `getName()` in event classes to build event names in subscribers
1116

1217
7.0
1318
---

Event/Event.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,13 @@ public function getTransition(): ?Transition
4646
return $this->transition;
4747
}
4848

49+
/**
50+
* @deprecated since Symfony 7.3, inject the workflow in the constructor where you need it
51+
*/
4952
public function getWorkflow(): WorkflowInterface
5053
{
54+
trigger_deprecation('symfony/workflow', '7.3', 'The "%s()" method is deprecated, inject the workflow in the constructor where you need it.', __METHOD__);
55+
5156
return $this->workflow;
5257
}
5358

composer.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,16 @@
2020
}
2121
],
2222
"require": {
23-
"php": ">=8.2"
23+
"php": ">=8.2",
24+
"symfony/deprecation-contracts": "2.5|^3"
2425
},
2526
"require-dev": {
2627
"psr/log": "^1|^2|^3",
2728
"symfony/dependency-injection": "^6.4|^7.0",
28-
"symfony/event-dispatcher": "^6.4|^7.0",
2929
"symfony/error-handler": "^6.4|^7.0",
30-
"symfony/http-kernel": "^6.4|^7.0",
30+
"symfony/event-dispatcher": "^6.4|^7.0",
3131
"symfony/expression-language": "^6.4|^7.0",
32+
"symfony/http-kernel": "^6.4|^7.0",
3233
"symfony/security-core": "^6.4|^7.0",
3334
"symfony/stopwatch": "^6.4|^7.0",
3435
"symfony/validator": "^6.4|^7.0"

0 commit comments

Comments
 (0)