-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Added docs for Workflow component #6871
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
Changes from 1 commit
d0701f0
91867c2
69bca59
f99fbb2
e797f0c
5b2a029
196baf9
763950d
cead2f7
e0089c5
48de43d
805b237
f57ec14
03925ff
e6bdee6
c7464c7
83d26c1
6e7a35f
4415466
866b25a
dceebec
b959f8a
b45edf2
fefdb5f
7f0f5b0
c681283
86ecf0a
d002a8b
b0a8855
4e7cf11
3aa433d
4f277dc
2511c21
c9b1656
2cc2934
47dc11d
3250621
c0bd6da
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ You can install the component in 2 different ways: | |
* :doc:`Install it via Composer </components/using_components>` (``symfony/workflow`` on `Packagist`_); | ||
* Use the official Git repository (https://github.com/symfony/workflow). | ||
|
||
For more information, see the code in the Git Repository. | ||
.. include:: /components/require_autoload.rst.inc | ||
|
||
Usage | ||
----- | ||
|
@@ -29,11 +29,11 @@ define *places* (or *states*) and *transactions*. A transaction describes the ac | |
|
||
.. image:: /_images/components/workflow/states_transactions.png | ||
|
||
A set of places and ``Transaction``s form a ``Definition``. A ``Workflow`` needs a ``Definition`` and a way to write | ||
the states to the objects, ie a ``MarkingStoreInterface``. | ||
A set of places and ``Transaction's`` creates a ``Definition``. A ``Workflow`` needs a ``Definition`` and a way to write | ||
the states to the objects, ie an instance of a ``MarkingStoreInterface``. | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should also the initial place with something like: |
||
Consider the following example for a blog post. A post can have places: 'draft', 'review', 'rejected', 'published'. You | ||
can define the workflow like this: | ||
can define the workflow like this:: | ||
|
||
$states = ['draft', 'review', 'rejected', 'published']; | ||
$transactions[] = new Transition('to_review', ['draft', 'rejected'], 'review'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will not work. See symfony/symfony#19605 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please add use statements for classes in the first code example you're using them. |
||
|
@@ -46,8 +46,7 @@ can define the workflow like this: | |
$marking = new ScalarMarkingStore('currentState'); | ||
$workflow = new Workflow($definition, $marking); | ||
|
||
The ``Workflow`` can now help you do decide what actions that are allowed on a blog post. | ||
|
||
The ``Workflow`` can now help you do decide what actions that are allowed on a blog post.: | ||
|
||
$post = new \stdClass(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's use an imaginary There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please prepend this example with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would rather show the definition of the BlogPost class since it is important that there is a field called |
||
$post->currentState = null; | ||
|
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.
as a general rule, the read flow should be as continuous as possible. As such, I would remove the literals here: