Skip to content

[Workflow] Deprecate GuardEvent::setBlocked() method #34466

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions UPGRADE-4.4.md
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,11 @@ WebServerBundle

* The bundle is deprecated and will be removed in 5.0.

Workflow
--------

* Deprecated `GuardEvent::setBlocked()` method, use `GuardEvent::addTransitionBlocker()` instead.

Yaml
----

Expand Down
2 changes: 2 additions & 0 deletions UPGRADE-5.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,8 @@ Workflow
type: state_machine
```

* Deprecated `GuardEvent::setBlocked()` method, use `GuardEvent::addTransitionBlocker()` instead.

Yaml
----

Expand Down
1 change: 1 addition & 0 deletions src/Symfony/Component/Workflow/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ CHANGELOG
-----

* Marked all dispatched event classes as `@final`
* Deprecated `GuardEvent::setBlocked()` method, use `GuardEvent::addTransitionBlocker()` instead.

4.3.0
-----
Expand Down
7 changes: 7 additions & 0 deletions src/Symfony/Component/Workflow/Event/GuardEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,15 @@ public function isBlocked()
return !$this->transitionBlockerList->isEmpty();
}

/**
* @deprecated Deprecated since Symfony 5.0, use addTransitionBlocker instead.
*
* @param bool $blocked
*/
public function setBlocked($blocked)
{
@trigger_error(sprintf('The "%s" function is deprecated since Symfony 5.0, use "%s" instead.', 'setBlocked', 'addTransitionBlocker'), E_USER_DEPRECATED);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since 4.4

Copy link
Contributor

@noniagriconomie noniagriconomie Nov 20, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason to process the string with sprintf and not write directly?

Feature related: « which is difficult to debug « transition blocker was aded after set blocked, and its aims is not for debug but more for end user app human understanding
For debug, i mean technical human, there is a trail logger iirc


if (!$blocked) {
$this->transitionBlockerList->clear();

Expand Down