Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[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

Merged
merged 1 commit into from
Apr 3, 2017

Conversation

lyrixx
Copy link
Member

@lyrixx lyrixx commented Mar 27, 2017

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:

{{ workflow_marked_places(post)|join(',') }}

Copy link
Contributor

@HeahDude HeahDude left a 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
Copy link
Contributor

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
Copy link
Contributor

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.

Copy link
Member Author

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')),
Copy link
Contributor

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.

Copy link
Member Author

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.

@lyrixx
Copy link
Member Author

lyrixx commented Mar 28, 2017

Comments addressed.

@lyrixx lyrixx changed the title [Workflow] Added 'workflow_places' twig function [Workflow] Added 'workflow_marked_places' twig function Mar 28, 2017
@nicolas-grekas nicolas-grekas added this to the 3.3 milestone Mar 28, 2017
* Returns true if the place is marked.
*
* @param object $subject A subject
* @param string $transitionName A transition
Copy link
Contributor

Choose a reason for hiding this comment

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

This phpdoc is wrong.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.

}

/**
* Returns all places.
Copy link
Contributor

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?

Copy link
Member Author

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.
@lyrixx
Copy link
Member Author

lyrixx commented Mar 29, 2017

Failures are not related.

Copy link
Contributor

@HeahDude HeahDude left a comment

Choose a reason for hiding this comment

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

👍

@lyrixx
Copy link
Member Author

lyrixx commented Apr 3, 2017

👍

@lyrixx lyrixx merged commit ead6f14 into symfony:master Apr 3, 2017
lyrixx added a commit that referenced this pull request Apr 3, 2017
…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
chalasr pushed a commit to chalasr/symfony that referenced this pull request Apr 5, 2017
…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
@fabpot fabpot mentioned this pull request May 1, 2017
@lyrixx lyrixx deleted the workflow-places branch June 27, 2017 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants