1

In workflow.yml I define initial_place.

framework:
    workflows:
        case_workflow:
            type: 'workflow' # or 'state_machine'
            audit_trail:
                enabled: true
            marking_store:
                type: 'multiple_state' # or 'single_state'
                arguments:
                    - 'currentPlace'
            supports:
                - App\Entity\Cases\CoreCase

            initial_place: initial

            places:
                - initial
                - review
                - rejected
                - published

            transitions:
                to_review:
                    from: initial
                    to:   review
                publish:
                    from: review
                    to:   published
                reject:
                    from: review
                    to:   rejected

In the entity I have defined the property

/**
 * @ORM\Column(type="string", length=50)
 */
private $currentPlace;

In the controller I create the entity and persist it

$dieselCase = new DieselCase();
$dieselCase->setUser($account);
$dieselCase->setCustomer($account);
$em->persist($dieselCase);
$em->flush();

But currentPlace is not set to initial. Is it a bug in the workflow bundle? How can I solve this problem?

olek07
  • 513
  • 2
  • 7
  • 21

1 Answers1

3

Very Late answer but, This is how Symfony works. null == initial_place

If you use the WorkflowInterface and getMarking($dieselCase) when the db is null it will report that the place is ['initial'] as you have configured. Or if you use marking_store: type: 'single_state' it will report 'initial'.

The 'currentPlace' marking store will only be populated once you perform a $workflow->apply($dieselCase, 'to_review')

Chad
  • 1,139
  • 17
  • 41