PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, February 20, 2022

[FIXED] Workflow in Symfony doesn't work with "multiple_state"

 February 20, 2022     php, symfony, symfony-workflows, symfony5     No comments   

Issue

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.


Solution

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



Answered By - user14280311
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing