Description
Symfony version(s) affected: 5.2.0
Description
After upgrading my application to Symfony 5.2.0, I got an error when clearing the cache or calling php bin/console debug:autowiring workflow
:
Argument 2 of service "state_machine.abstract" is abstract: marking store.
I have a single (and very simple) workflow:
framework:
workflows:
report_monthly:
type: state_machine
marking_store: ~
supports:
- App\Entity\MyWorkflowedEntityWithAMarkingProperty
initial_marking: my_initial_marking
places:
- my_initial_marking
- another_marking
transitions:
finalize_data:
from: my_initial_marking
to: another_marking
When I configure the marking_store.type
explicitly to its only valid value 'method', the error messages disappears. This stands in contrast to the documentation https://symfony.com/doc/current/workflow.html :
The marking_store.type (the default value depends on the type value) and property (default value ['marking']) attributes of the marking_store option are optional. If omitted, their default values will be used. It’s highly recommended to use the default value.
How to reproduce
Configure a workflow of type state_machine
without setting marking_store
type explicitly.
Possible Solution
Besides configuring the marking_store.type
explicitly, adding a default value to marking_store.type
in symfony/framework-bundle/DependencyInjection/Configuration.php
also solves the problem (at least for cases, where marking_store
is set to ~
as in the example, cases where marking_store
isn't set at all still don't work):
->arrayNode('marking_store')
->children()
->enumNode('type')
->values(['method'])
->defaultValue('method') // added a default value
->end()
->scalarNode('property')
->defaultValue('marking')
->end()
->scalarNode('service')
->cannotBeEmpty()
->end()
->end()
->end()
Additional context
Note: This code hasn't changed from Symfony 5.1 to 5.2, so the problem causing the error must be at another point.