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 @@ -294,6 +294,41 @@ what actions are allowed on a blog post::
294
294
// See a specific available transition for the post in the current state
295
295
$transition = $workflow->getEnabledTransition($post, 'publish');
296
296
297
+ Using a multiple state marking store
298
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
299
+
300
+ If you are creating a :doc: `workflow </workflow/workflow-and-state-machine >`,
301
+ your marking store may need to contain multiple places at the same time. That's why,
302
+ if you are using Doctrine, the matching column definition should use the type ``json ``::
303
+
304
+ // src/Entity/BlogPost.php
305
+ namespace App\Entity;
306
+
307
+ use Doctrine\DBAL\Types\Types;
308
+ use Doctrine\ORM\Mapping as ORM;
309
+
310
+ #[ORM\Entity]
311
+ class BlogPost
312
+ {
313
+ #[ORM\Id]
314
+ #[ORM\GeneratedValue]
315
+ #[ORM\Column]
316
+ private int $id;
317
+
318
+ #[ORM\Column(type: Types::JSON)]
319
+ private array $currentPlaces;
320
+
321
+ // ...
322
+ }
323
+
324
+ .. caution ::
325
+
326
+ You should not use the type ``simple_array `` for your marking store. Inside
327
+ a multiple state marking store, places are stored as keys with a value of one,
328
+ such as ``['draft' => 1] ``. If the marking store contains only one place,
329
+ this Doctrine type will store its value only as a string, resulting in the
330
+ loss of the object's current place.
331
+
297
332
Accessing the Workflow in a Class
298
333
---------------------------------
299
334
You can’t perform that action at this time.
0 commit comments