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] Added Context to Workflow Event#37539

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
lyrixx merged 1 commit intosymfony:masterfromShaurifr:eventWithContext
Aug 12, 2020

Conversation

epitre
Copy link
Contributor

There's also a default context for the initial marking event.

QA
Branch?master
Bug fix?no
New feature?yes
Deprecations?no
TicketsFix#37421
LicenseMIT
Doc PRsymfony/symfony-docs#13947

This time, I need context in the events, because, sometimes, the transition is automatic and sometimes, it is manual. I want to be able to make the difference. I figured using the context for that is a good idea. I hope you do too :)

By the way, I believe it alsofixes#37421 . I took@pluk77 request to be able to differentiate an initial marking by having a default context in that case

greeflas reacted with thumbs up emoji
@epitre
Copy link
ContributorAuthor

appveyor is not happy but I believe it has nothing to do with me. Does it ?

@epitreepitreforce-pushed theeventWithContext branch 2 times, most recently fromee4d388 to348cb02CompareJuly 9, 2020 11:07
@epitreepitre changed the titleAdded Context to Workflow Event[Workflow] Added Context to Workflow EventJul 9, 2020
*/
class Workflow implements WorkflowInterface
{
public const DISABLE_ANNOUNCE_EVENT = 'workflow_disable_announce_event';
public const DEFAULT_INITIAL_CONTEXT = ['initial' => true];
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason you made this an associative array and not an indexed one?
public const DEFAULT_INITIAL_CONTEXT = ['initial'];

I see in one of your tests you did use an indexed array as $context.

Are yuo

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

this way, you can do :
if ($context['initial']??false)

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 for your PR but I already rejected in the past

@epitre
Copy link
ContributorAuthor

Thanks for your PR but I already rejected in the past

O_O Does it mean you are rejecting this one ?

What I want, is to be able to differentiate transitions that will be done automatically from others that will be done manually.
If not with the context, how do you suggest to do that ?

@epitre
Copy link
ContributorAuthor

epitre commentedJul 9, 2020
edited
Loading

Thanks for your PR but I already rejected in the past

I found an oldPR and realized the TransitionEvent knows the context ^^

I'll use this event, then. But I really don't understand why the other events do not deserve to know the context ^^

@lyrixx
Copy link
Member

Oups, I write the comment but I forgot to remove it 👍

I'm against to put the context in the guard event but for other event I guess this is fine 👍

O_O Does it mean you are rejecting this one ?

nope, it's OK 👍

Sorry for my bad comment

@epitre
Copy link
ContributorAuthor

Oups, I write the comment but I forgot to remove it +1

I'm against to put the context in the guard event but for other event I guess this is fine +1

O_O Does it mean you are rejecting this one ?

nope, it's OK +1

Sorry for my bad comment

Great ! So, GuardEvent is not aware of the context anymore. I simplified TransitionEvent. And TransitionEvent is still the only event which can change the context.

@epitreepitreforce-pushed theeventWithContext branch 3 times, most recently from7756024 to2b1651cCompareJuly 9, 2020 15:23
@nicolas-grekasnicolas-grekas added this to thenext milestoneJul 9, 2020
@@ -395,34 +400,38 @@ private function entered(object $subject, ?Transition $transition, Marking $mark
foreach ($transition->getTos() as $place) {
$this->dispatcher->dispatch($event, sprintf('workflow.%s.entered.%s', $this->name, $place));
}
} elseif (!empty($this->definition->getInitialPlaces())) {
Copy link
Member

Choose a reason for hiding this comment

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

This is not related to the current PR. Could you revert it? thanks

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

without that, the DEFAULT_INITIAL_CONTEXT makes no sense.

it's a little far fetched, but I believe adding this context enhancement is a good moment to add this default context

Unless you don't want a DEFAULT_INITIAL_CONTEXT ?

There's also a default context for the initial marking event.
@epitre
Copy link
ContributorAuthor

@lyrixx up !

@lyrixx
Copy link
Member

I'm gonna merge your PR, but I also gonna tweak 2/3 things

Thanks for your work and your patience

@lyrixx
Copy link
Member

Thank you@epitre.

@lyrixxlyrixx merged commit25095d8 intosymfony:masterAug 12, 2020
fabpot added a commit that referenced this pull requestAug 12, 2020
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
@epitre
Copy link
ContributorAuthor

@lyrixx Thank you :)

Could you link me the changes you make, just to be informed, please ?

@lyrixx
Copy link
Member

Just above:#37813

epitre reacted with thumbs up emoji

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

@pluk77pluk77pluk77 left review comments

@ro0NLro0NLro0NL left review comments

@lyrixxlyrixxlyrixx approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
5.2
Development

Successfully merging this pull request may close these issues.

Workflow initial_marking is optional and entered event on initial_marking is not dispatched
6 participants
@epitre@lyrixx@pluk77@ro0NL@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp