Skip to content
Advertisement

Workflow in Symfony doesn’t work with “multiple_state”

In one of the configuration files of Symfony 5.2.8 with Workflow 5.2.7 I have:

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

When I execute bin/console I have error:

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

When I change the configuration to:

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

I get the error:

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

It works when I change to this:

        marking_store:
            type: 'method'
            property: main_state

Anybody have idea what can I do to works with multiple_state? Thanks in advance.

Advertisement

Answer

From the 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.

So if you configure type “workflow” it should automatically be “multiple_state”. You could dump your entity and the state property should be of type array

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement