-
-
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 |
---|---|---|
|
@@ -140,6 +140,31 @@ Below is the configuration for the pull request state machine. | |
</framework:config> | ||
</container> | ||
|
||
.. code-block:: php | ||
|
||
use Symfony\Component\Workflow\Definition; | ||
use Symfony\Component\Workflow\Transition; | ||
use Symfony\Component\Workflow\StateMachine; | ||
use Symfony\Component\Workflow\MarkingStore\ScalarMarkingStore; | ||
|
||
$states = ['start', 'coding', 'travis', 'review', 'merged', 'closed']; | ||
$transitions[] = new Transition('submit', 'start', 'travis'); | ||
$transitions[] = new Transition('update', 'coding', 'travis'); | ||
$transitions[] = new Transition('update', 'travis', 'travis'); | ||
$transitions[] = new Transition('update', 'review', 'travis'); | ||
$transitions[] = new Transition('wait_for_reivew', 'travis', 'review'); | ||
$transitions[] = new Transition('change_needed', 'review', 'coding'); | ||
$transitions[] = new Transition('accepted', 'review', 'merged'); | ||
$transitions[] = new Transition('rejected', 'review', 'closed'); | ||
$transitions[] = new Transition('reopened', 'closed', 'review'); | ||
|
||
$definition = new Definition($states, $transitions); | ||
$definition->setInitialPlace('start'); | ||
|
||
$marking = new ScalarMarkingStore('marking'); | ||
$stateMachine = new StateMachine($definition, $marking); | ||
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. Actually, we need to show how to configure the DI extension config instead of initially building the workflow itself (same below). 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 are correct. I'll fix this. Thank you for your feedback |
||
|
||
|
||
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. These extra blank lines can be removed 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. multiple blank lines should always be just one |
||
You can now use this state machine by getting the ``state_machine.pull_request`` service:: | ||
|
||
$stateMachine = $this->container->get('state_machine.pull_request'); | ||
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. Ping @rufinus. Thank you for the feedback. I've added this example now. |
||
|
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.
please add a comment at the top of the file:
// app/config/config.php