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

Appearance settings

[4.3] Update workflow config #12146

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 6 commits into from
Aug 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion 3 components/workflow.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,11 @@ Usage
-----

When you have configured a ``Registry`` with your workflows,
you can retrieve a workflow from it and use it as follows::
you can retreive a workflow from it and use it as follows::
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like retrieve is the right orthography.


// ...
// Consider that $blogPost is in place "draft" by default
// Consider that $post is in state "draft" by default
Copy link
Contributor

Choose a reason for hiding this comment

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

The variable $post doesn't exist.

Copy link
Contributor

Choose a reason for hiding this comment

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

yes i updated it in another PR, and on the original one i added this line
which then create a fail merge :/

$blogPost = new BlogPost();
$workflow = $registry->get($blogPost);

Expand Down
23 changes: 16 additions & 7 deletions 23 reference/configuration/framework.rst
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,9 @@ Configuration
* :ref:`name <reference-workflows-name>`

* `audit_trail`_
* `initial_place`_
* `initial_marking`_
* `marking_store`_
* `metadata`_
* `places`_
* `supports`_
* `support_strategy`_
Expand Down Expand Up @@ -2736,12 +2737,12 @@ audit_trail
If set to ``true``, the :class:`Symfony\\Component\\Workflow\\EventListener\\AuditTrailListener`
will be enabled.

initial_place
"""""""""""""
initial_marking
"""""""""""""""

**type**: ``string`` **default**: ``null``
**type**: ``string`` | ``array``

One of the ``places`` or ``null``. If not null and the supported object is not
One of the ``places`` or ``empty``. If not null and the supported object is not
already initialized via the workflow, this place will be set.

marking_store
Expand All @@ -2753,8 +2754,16 @@ Each marking store can define any of these options:

* ``arguments`` (**type**: ``array``)
* ``service`` (**type**: ``string``)
* ``type`` (**type**: ``string`` **possible values**: ``'multiple_state'`` or
``'single_state'``)
* ``type`` (**type**: ``string`` **allow value**: ``'method'``)

metadata
""""""""

**type**: ``array``

Metadata available for the workflow configuration.
Note that ``places`` and ``transitions`` can also have their own
``metadata`` entry.

places
""""""
Expand Down
39 changes: 11 additions & 28 deletions 39 workflow.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ like this:
audit_trail:
enabled: true
marking_store:
type: 'multiple_state' # or 'single_state'
arguments:
type: 'method'
property:
- 'currentPlace'
supports:
- App\Entity\BlogPost
initial_place: draft
initial_marking: draft
places:
- draft
- reviewed
Expand Down Expand Up @@ -90,35 +90,28 @@ like this:
<framework:config>
<framework:workflow name="blog_publishing" type="workflow">
<framework:audit-trail enabled="true"/>

<framework:marking-store type="single_state">
<framework:argument>currentPlace</framework:argument>
</framework:marking-store>

<framework:support>App\Entity\BlogPost</framework:support>

<framework:initial-marking>draft</framework:initial-marking>
<framework:place>draft</framework:place>
<framework:place>reviewed</framework:place>
<framework:place>rejected</framework:place>
<framework:place>published</framework:place>

<framework:transition name="to_review">
<framework:from>draft</framework:from>
<framework:to>reviewed</framework:to>
</framework:transition>

<framework:transition name="publish">
<framework:from>reviewed</framework:from>
<framework:to>published</framework:to>
</framework:transition>

<framework:transition name="reject">
<framework:from>reviewed</framework:from>
<framework:to>rejected</framework:to>
</framework:transition>

</framework:workflow>

</framework:config>
</container>

Expand All @@ -134,10 +127,11 @@ like this:
'enabled' => true
],
'marking_store' => [
'type' => 'multiple_state', // or 'single_state'
'arguments' => ['currentPlace']
'type' => 'method'
'property' => ['currentPlace']
],
'supports' => ['App\Entity\BlogPost'],
'initial_marking' => 'draft',
'places' => [
'draft',
'reviewed',
Expand Down Expand Up @@ -177,18 +171,6 @@ As configured, the following property is used by the marking store::
public $content;
}

.. note::

The marking store type could be "multiple_state" or "single_state". A single
state marking store does not support a model being on multiple places at the
same time.

.. tip::

The ``type`` (default value ``single_state``) and ``arguments`` (default
value ``marking``) attributes of the ``marking_store`` option are optional.
If omitted, their default values will be used.

.. tip::

Setting the ``audit_trail.enabled`` option to ``true`` makes the application
Expand All @@ -200,7 +182,7 @@ what actions are allowed on a blog post::
use App\Entity\BlogPost;
use Symfony\Component\Workflow\Exception\LogicException;

$post = BlogPost();
$post = new BlogPost();

$workflow = $this->container->get('workflow.blog_publishing');
$workflow->can($post, 'publish'); // False
Expand Down Expand Up @@ -630,8 +612,8 @@ requires:
<framework:from>reviewed</framework:from>
<framework:to>published</framework:to>
<framework:metadata>
<framework:hour_limit>20</framework:priority>
<framework:explanation>You can not publish after 8 PM.</framework:priority>
<framework:hour_limit>20</framework:hour_limit>
<framework:explanation>You can not publish after 8 PM.</framework:explanation>
</framework:metadata>
</framework:transition>
</framework:workflow>
Expand Down Expand Up @@ -682,6 +664,7 @@ Then you can access this metadata in your controller as follows::

use App\Entity\BlogPost;
use Symfony\Component\Workflow\Registry;
use App\Entity\BlogPost;

public function myController(Registry $registry, BlogPost $post)
{
Expand Down
106 changes: 53 additions & 53 deletions 106 workflow/dumping-workflows.rst
Original file line number Diff line number Diff line change
Expand Up @@ -228,63 +228,63 @@ Below is the configuration for the pull request state machine with styling added
// ...
'workflows' => [
'pull_request' => [
'type' => 'state_machine',
'supports' => ['App\Entity\PullRequest'],
'places' => [
'start',
'coding',
'test',
'review' => [
'metadata' => [
'description' => 'Human review',
'type' => 'state_machine',
'supports' => ['App\Entity\PullRequest'],
'places' => [
'start',
'coding',
'test',
'review' => [
'metadata' => [
'description' => 'Human review',
],
],
],
'merged',
'closed' => [
'metadata' => [
'bg_color' => 'DeepSkyBlue',
'merged',
'closed' => [
'metadata' => [
'bg_color' => 'DeepSkyBlue',
],
],
],
],
'transitions' => [
'submit'=> [
'from' => 'start',
'to' => 'test',
],
'update'=> [
'from' => ['coding', 'test', 'review'],
'to' => 'test',
'metadata' => [
'arrow_color' => 'Turquoise',
],
],
'wait_for_review'=> [
'from' => 'test',
'to' => 'review',
'metadata' => [
'color' => 'Orange',
],
],
'request_change'=> [
'from' => 'review',
'to' => 'coding',
],
'accept'=> [
'from' => 'review',
'to' => 'merged',
'metadata' => [
'label' => 'Accept PR',
],
],
'reject'=> [
'from' => 'review',
'to' => 'closed',
],
'reopen'=> [
'from' => 'start',
'to' => 'review',
'transitions' => [
'submit'=> [
'from' => 'start',
'to' => 'test',
],
'update'=> [
'from' => ['coding', 'test', 'review'],
'to' => 'test',
'metadata' => [
'arrow_color' => 'Turquoise',
],
],
'wait_for_review'=> [
'from' => 'test',
'to' => 'review',
'metadata' => [
'color' => 'Orange',
],
],
'request_change'=> [
'from' => 'review',
'to' => 'coding',
],
'accept'=> [
'from' => 'review',
'to' => 'merged',
'metadata' => [
'label' => 'Accept PR',
],
],
'reject'=> [
'from' => 'review',
'to' => 'closed',
],
'reopen'=> [
'from' => 'start',
'to' => 'review',
],
],
],
],
],
]);
Expand Down
78 changes: 39 additions & 39 deletions 78 workflow/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Below is the configuration for the pull request state machine.
type: 'state_machine'
supports:
- App\Entity\PullRequest
initial_place: start
initial_marking: start
places:
- start
- coding
Expand Down Expand Up @@ -190,46 +190,46 @@ Below is the configuration for the pull request state machine.
// ...
'workflows' => [
'pull_request' => [
'type' => 'state_machine',
'supports' => ['App\Entity\PullRequest'],
'places' => [
'start',
'coding',
'test',
'review',
'merged',
'closed',
],
'transitions' => [
'submit'=> [
'from' => 'start',
'to' => 'test',
'type' => 'state_machine',
'supports' => ['App\Entity\PullRequest'],
'places' => [
'start',
'coding',
'test',
'review',
'merged',
'closed',
],
'update'=> [
'from' => ['coding', 'test', 'review'],
'to' => 'test',
'transitions' => [
'submit'=> [
'from' => 'start',
'to' => 'test',
],
'update'=> [
'from' => ['coding', 'test', 'review'],
'to' => 'test',
],
'wait_for_review'=> [
'from' => 'test',
'to' => 'review',
],
'request_change'=> [
'from' => 'review',
'to' => 'coding',
],
'accept'=> [
'from' => 'review',
'to' => 'merged',
],
'reject'=> [
'from' => 'review',
'to' => 'closed',
],
'reopen'=> [
'from' => 'start',
'to' => 'review',
],
],
'wait_for_review'=> [
'from' => 'test',
'to' => 'review',
],
'request_change'=> [
'from' => 'review',
'to' => 'coding',
],
'accept'=> [
'from' => 'review',
'to' => 'merged',
],
'reject'=> [
'from' => 'review',
'to' => 'closed',
],
'reopen'=> [
'from' => 'start',
'to' => 'review',
],
],
],
],
]);
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.