Skip to content

Commit 77c49b3

Browse files
[Workflow] Support omitting places option
1 parent 9804422 commit 77c49b3

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

Diff for: workflow.rst

+16-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ follows:
6060
supports:
6161
- App\Entity\BlogPost
6262
initial_marking: draft
63-
places:
63+
places: # defining places manually is optional
6464
- draft
6565
- reviewed
6666
- rejected
@@ -97,10 +97,13 @@ follows:
9797
</framework:marking-store>
9898
<framework:support>App\Entity\BlogPost</framework:support>
9999
<framework:initial-marking>draft</framework:initial-marking>
100+
101+
<!-- defining places manually is optional -->
100102
<framework:place>draft</framework:place>
101103
<framework:place>reviewed</framework:place>
102104
<framework:place>rejected</framework:place>
103105
<framework:place>published</framework:place>
106+
104107
<framework:transition name="to_review">
105108
<framework:from>draft</framework:from>
106109
<framework:to>reviewed</framework:to>
@@ -135,6 +138,7 @@ follows:
135138
->type('method')
136139
->property('currentPlace');
137140
141+
// defining places manually is optional
138142
$blogPublishing->place()->name('draft');
139143
$blogPublishing->place()->name('reviewed');
140144
$blogPublishing->place()->name('rejected');
@@ -168,6 +172,17 @@ follows:
168172
``'draft'`` or ``!php/const App\Entity\BlogPost::TRANSITION_TO_REVIEW``
169173
instead of ``'to_review'``.
170174

175+
.. tip::
176+
177+
You can omit the ``places`` option if your transitions define all the places
178+
that are used in the workflow. Symfony will automatically extract the places
179+
from the transitions.
180+
181+
.. versionadded:: 7.1
182+
183+
The support for omitting the ``places`` option was introduced in
184+
Symfony 7.1.
185+
171186
The configured property will be used via its implemented getter/setter methods by the marking store::
172187

173188
// src/Entity/BlogPost.php

Diff for: workflow/workflow-and-state-machine.rst

+11
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,17 @@ Below is the configuration for the pull request state machine.
252252
->to(['review']);
253253
};
254254
255+
.. tip::
256+
257+
You can omit the ``places`` option if your transitions define all the places
258+
that are used in the workflow. Symfony will automatically extract the places
259+
from the transitions.
260+
261+
.. versionadded:: 7.1
262+
263+
The support for omitting the ``places`` option was introduced in
264+
Symfony 7.1.
265+
255266
Symfony automatically creates a service for each workflow (:class:`Symfony\\Component\\Workflow\\Workflow`)
256267
or state machine (:class:`Symfony\\Component\\Workflow\\StateMachine`) you
257268
have defined in your configuration. You can use the workflow inside a class by using

0 commit comments

Comments
 (0)