-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Workflow] Added 'workflow_marked_places' twig function #22180
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
Conversation
659bd29
to
4a2335a
Compare
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.
Adding this method looks really consistent, 👍
* Returns true if the transition is enabled. | ||
* | ||
* @param object $subject A subject | ||
* @param string $transitionName A transition |
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 parameter name mismatches the one of the signature and same below.
* Returns true if the transition is enabled. | ||
* | ||
* @param object $subject A subject | ||
* @param string $transitionName A transition |
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 one should even be added in 3.2.
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.
Fixed in #22195
@@ -33,22 +33,69 @@ public function getFunctions() | |||
new \Twig_SimpleFunction('workflow_can', array($this, 'canTransition')), | |||
new \Twig_SimpleFunction('workflow_transitions', array($this, 'getEnabledTransitions')), | |||
new \Twig_SimpleFunction('workflow_has_marked_place', array($this, 'hasMarkedPlace')), | |||
new \Twig_SimpleFunction('workflow_places', array($this, 'getMarkedPlaces')), |
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.
It should be workflow_marked_places
to avoid confusion as you stated in the previous PR.
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.
I did not choose workflow_marked_places
in order to be consistant with workflow_transitions
.
But you are right, I updated the PR.
Thanks.
Comments addressed. |
* Returns true if the place is marked. | ||
* | ||
* @param object $subject A subject | ||
* @param string $transitionName A transition |
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 phpdoc is wrong.
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.
Fixed.
} | ||
|
||
/** | ||
* Returns all places. |
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.
Hmmm, maybe this should be more accurate?
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.
done.
When someone uses a custom MarkingStore, the value in the $subject::marking can be really different from the value inside Marking::getPlaces(). This occurs, for example, when the value stored in the subject is a bit mask. So it's always safer to get the places names from the marking, and so with this new function.
Failures are not related. |
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.
👍
👍 |
…n (lyrixx) This PR was merged into the 3.3-dev branch. Discussion ---------- [Workflow] Added 'workflow_marked_places' twig function | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - --- When someone uses a custom MarkingStore, the value in the $subject::marking can be really different from the value inside Marking::getPlaces(). This occurs, for example, when the value stored in the subject is a bit mask. So it's always safer to get the places names from the marking, and so with this new function. --- usage: ```twig {{ workflow_marked_places(post)|join(',') }} ``` Commits ------- ead6f14 [Workflow] Added 'workflow_marked_places' twig function
…function (lyrixx) This PR was merged into the 3.3-dev branch. Discussion ---------- [Workflow] Added 'workflow_marked_places' twig function | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - --- When someone uses a custom MarkingStore, the value in the $subject::marking can be really different from the value inside Marking::getPlaces(). This occurs, for example, when the value stored in the subject is a bit mask. So it's always safer to get the places names from the marking, and so with this new function. --- usage: ```twig {{ workflow_marked_places(post)|join(',') }} ``` Commits ------- ead6f14 [Workflow] Added 'workflow_marked_places' twig function
When someone uses a custom MarkingStore, the value in the
$subject::marking can be really different from the value inside
Marking::getPlaces(). This occurs, for example, when the value stored in
the subject is a bit mask.
So it's always safer to get the places names from the marking, and so
with this new function.
usage: