Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb5f8a39

Browse files
committed
Merge branch '7.0' into 7.1
* 7.0: [Workflow] Add type information for multiple state marking store
2 parentsf6406c8 +78a9478 commitb5f8a39

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

‎workflow.rst‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,41 @@ what actions are allowed on a blog post::
294294
// See a specific available transition for the post in the current state
295295
$transition = $workflow->getEnabledTransition($post, 'publish');
296296

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+
297332
Accessing the Workflow in a Class
298333
---------------------------------
299334

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp