Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.6k
[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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
appveyor is not happy but I believe it has nothing to do with me. Does it ? |
ee4d388
to348cb02
CompareUh oh!
There was an error while loading.Please reload this page.
*/ | ||
class Workflow implements WorkflowInterface | ||
{ | ||
public const DISABLE_ANNOUNCE_EVENT = 'workflow_disable_announce_event'; | ||
public const DEFAULT_INITIAL_CONTEXT = ['initial' => true]; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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)
There was a problem hiding this 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
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
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. |
epitre commentedJul 9, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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 ^^ |
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 👍
nope, it's OK 👍 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. |
7756024
to2b1651c
CompareUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
@@ -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())) { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
@lyrixx up ! |
I'm gonna merge your PR, but I also gonna tweak 2/3 things Thanks for your work and your patience |
Thank you@epitre. |
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
@lyrixx Thank you :) Could you link me the changes you make, just to be informed, please ? |
Just above:#37813 |
There's also a default context for the initial marking event.
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