Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

[Workflow] deprecateGuardEvent::getContext method#51484

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

@hhamon
Copy link
Contributor

@hhamonhhamon commentedAug 25, 2023
edited
Loading

QA
Branch?6.4
Bug fix?no
New feature?no
Deprecations?yes
Tickets~
LicenseMIT
Doc PR~

As discussed with@lyrixx, this method is confusing as the context given as the 3rd argument to theWorflowInterface::appy() method is never passed along to the guard events. According to@lyrixx, the guard listeners must take any decisions based on the subject itself and not on the given contextual data (which are supposed to remain metadata). As a consequence, calling thegetContext method on aGuardEvent object always returns an empty context.

To prevent confusion and lower the BC breakage in 7.x, we advocate for deprecating this method in 6.4 and make it throw an exception in 7.0. Application codes should not call this method anyway as it always returns an empty array.

EDIT: a second approach in Symfony 7.x is to remove thegetContext method from the base abstract class and reimplement it as a dedicated trait that is used by all the other event classes exceptGuardEvent. This approach is probably a bit cleaner as the method will completly be dropped from theGuardEvent class scope.

Any thoughts?

@hhamonhhamon requested a review fromlyrixx as acode ownerAugust 25, 2023 12:43
@carsonbotcarsonbot added this to the6.4 milestoneAug 25, 2023
@carsonbotcarsonbot changed the titleWIP: [Workflow] deprecateGuardEvent::getContext method[Workflow] WIP: deprecateGuardEvent::getContext methodAug 25, 2023
@hhamonhhamonforce-pushed thedeprecate-guard-event-get-context branch from6019e12 to89e5c00CompareAugust 25, 2023 12:45
@hhamonhhamonforce-pushed thedeprecate-guard-event-get-context branch from89e5c00 toc31d044CompareAugust 26, 2023 10:41
@hhamonhhamon changed the title[Workflow] WIP: deprecateGuardEvent::getContext method[Workflow] deprecateGuardEvent::getContext methodAug 26, 2023
@hhamonhhamonforce-pushed thedeprecate-guard-event-get-context branch fromc31d044 tod47b6beCompareAugust 26, 2023 10:43
Copy link
Member

@lyrixxlyrixx left a comment

Choose a reason for hiding this comment

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

Thanks

@fabpot
Copy link
Member

Thank you@hhamon.

@fabpotfabpot merged commitedd1cb4 intosymfony:6.4Aug 30, 2023
fabpot added a commit that referenced this pull requestAug 30, 2023
…ontextTrait` trait (hhamon)This PR was merged into the 7.0 branch.Discussion----------Remove `GuardEvent::getContext()` method and add `HasContextTrait` trait| Q             | A| ------------- | ---| Branch?       | 7.0| Bug fix?      | no| New feature?  | no| Deprecations? | no| Tickets       | Related to#51484| License       | MIT| Doc PR        | ~As discussed with `@lyrixx`, the `GuardEvent::getContext` method was confusing as the context given as the 3rd argument to the WorflowInterface::appy() method is never passed along to the guard events. According to `@lyrixx`, the guard listeners must take any decisions based on the subject itself and not on the given contextual data (which are supposed to remain metadata). As a consequence, calling the `GuardEvent::getContext()` method always returned an empty context array so far.To prevent this confusion any longer, the method has been deprecated in Symfony 6.4 (see#51484) and removed in this PR. The `GuardEvent` class hierarchy no longer has the `getContext` method while other event classes keep having it.Commits-------2aee3ae Remove `GuardEvent::getContext()` method and add `HasContextTrait` trait
fabpot added a commit that referenced this pull requestSep 5, 2023
…thout replacement (alexandre-daubois)This PR was merged into the 7.0 branch.Discussion----------[Workflow] Remove `GuardEvent::getContext()` method without replacement| Q             | A| ------------- | ---| Branch?       | 7.0| Bug fix?      | no| New feature?  | no| Deprecations? | no| Tickets       | -| License       | MIT| Doc PR        | -Follow-up of#51484Commits-------8271c56 [Workflow] Remove `GuardEvent::getContext()` method without replacement
@fabpotfabpot mentioned this pull requestOct 21, 2023
@fabpotfabpot mentioned this pull requestOct 21, 2023
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot approved these changes

@lyrixxlyrixxlyrixx approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

6.4

Development

Successfully merging this pull request may close these issues.

4 participants

@hhamon@fabpot@lyrixx@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp