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