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

RemoveGuardEvent::getContext() method and addHasContextTrait trait#51493

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
fabpot merged 1 commit intosymfony:7.0fromhhamon:remove-guard-event-get-context
Aug 30, 2023

Conversation

@hhamon
Copy link
Contributor

@hhamonhhamon commentedAug 26, 2023
edited
Loading

QA
Branch?7.0
Bug fix?no
New feature?no
Deprecations?no
TicketsRelated to#51484
LicenseMIT
Doc PR~

As discussed with@lyrixx, theGuardEvent::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 theGuardEvent::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. TheGuardEvent class hierarchy no longer has thegetContext method while other event classes keep having it.

@hhamonhhamon requested a review fromlyrixx as acode ownerAugust 26, 2023 11:29
@carsonbotcarsonbot added this to the7.0 milestoneAug 26, 2023
@hhamonhhamonforce-pushed theremove-guard-event-get-context branch 3 times, most recently frome9c9d72 to16b7e82CompareAugust 26, 2023 11:38
*/
trait HasContextTrait
{
privatearray$context = [];
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I made the propertyprivate instead ofprotected as all concrete classes using this trait are already allfinal. Although it may be a potential BC break, it should not as event classes are final and internal. Application code should are not supposed to extend the base abstractEvent class to produce new subtypes of workflow events.

* @author Grégoire Pineau <lyrixx@lyrixx.info>
* @author Hugo Hamon <hugohamon@neuf.fr>
*
* @internal
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Trait is markedinternal as it's not supposed to be used outside of the Workflow component itself.

*
* @internal
*/
trait HasContextTrait
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I'm not sure about the naming of this trait although it's purely made for an internal use. I was also thinking of naming itHoldContextTrait. Any other better suggestions are welcome and appreciated.

@hhamonhhamonforce-pushed theremove-guard-event-get-context branch from16b7e82 to56e8101CompareAugust 26, 2023 18:26
@hhamonhhamon changed the titleRemoveGuardEvent::getContext() method and addHasContextTrait trait[Workflow] RemoveGuardEvent::getContext() method and addHasContextTrait traitAug 26, 2023
@hhamonhhamonforce-pushed theremove-guard-event-get-context branch from56e8101 to2aee3aeCompareAugust 28, 2023 11:51
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

@carsonbotcarsonbot changed the title[Workflow] RemoveGuardEvent::getContext() method and addHasContextTrait traitRemoveGuardEvent::getContext() method and addHasContextTrait traitAug 30, 2023
@fabpot
Copy link
Member

Thank you@hhamon.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@lyrixxlyrixxlyrixx approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

7.0

Development

Successfully merging this pull request may close these issues.

4 participants

@hhamon@fabpot@lyrixx@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp