File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -279,6 +279,41 @@ what actions are allowed on a blog post::
279279 // See a specific available transition for the post in the current state
280280 $transition = $workflow->getEnabledTransition($post, 'publish');
281281
282+ Using a multiple state marking store
283+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
284+
285+ If you are creating a :doc: `workflow </workflow/workflow-and-state-machine >`,
286+ your marking store may need to contain multiple places at the same time. That's why,
287+ if you are using Doctrine, the matching column definition should use the type ``json ``::
288+
289+ // src/Entity/BlogPost.php
290+ namespace App\Entity;
291+
292+ use Doctrine\DBAL\Types\Types;
293+ use Doctrine\ORM\Mapping as ORM;
294+
295+ #[ORM\Entity]
296+ class BlogPost
297+ {
298+ #[ORM\Id]
299+ #[ORM\GeneratedValue]
300+ #[ORM\Column]
301+ private int $id;
302+
303+ #[ORM\Column(type: Types::JSON)]
304+ private array $currentPlaces;
305+
306+ // ...
307+ }
308+
309+ .. caution ::
310+
311+ You should not use the type ``simple_array `` for your marking store. Inside
312+ a multiple state marking store, places are stored as keys with a value of one,
313+ such as ``['draft' => 1] ``. If the marking store contains only one place,
314+ this Doctrine type will store its value only as a string, resulting in the
315+ loss of the object's current place.
316+
282317Accessing the Workflow in a Class
283318---------------------------------
284319
You can’t perform that action at this time.
0 commit comments