Symfony 中的工作流程不适用于 "multiple_state"

Workflow in Symfony doesn't work with "multiple_state"

在带有 Workflow 5.2.7 的 Symfony 5.2.8 配置文件之一中,我有:

    framework:
        workflows: 
            register_participation:
                type: 'workflow' # or 'state_machine'
                audit_trail:
                    enabled: true
                marking_store:
                    type: 'multiple_state'
                    arguments: 
                        - complexState
               # [...]

当我执行bin/console时出现错误:

Unrecognized option "arguments" under framework.workflows.workflows.register_participation.marking_store". Available options are "property", "service", "type".

当我将配置更改为:

    framework:
        workflows: 
            register_participation:
                type: 'workflow' # or 'state_machine'
                audit_trail:
                    enabled: true
                marking_store:
                    type: 'multiple_state'
                    property: state
       #         [...]

我收到错误:

The value "multiple_state" is not allowed for path framework.workflows.workflows.register_participation.marking_store.type". Permissible values: "method"

有效 当我改成这个时:

        marking_store:
            type: 'method'
            property: main_state

有人知道我可以用 multiple_state 做什么吗?提前致谢。

来自symfony workflow documentation

The marking store type could be “multiple_state” or “single_state”. A single state marking store does not support a model being on multiple places at the same time. This means a “workflow” must use a “multiple_state” marking store and a “state_machine” must use a “single_state” marking store. Symfony configures the marking store according to the “type” by default, so it’s preferable to not configure it.

A single state marking store uses a string to store the data. A multiple state marking store uses an array to store the data.

因此,如果您配置类型“工作流”,它应该自动为“multiple_state”。您可以转储您的实体,并且状态 属性 应该是数组

类型