8000 [Workflow] Increase checks to ensure a valid statemachine · Issue #33972 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
[Workflow] Increase checks to ensure a valid statemachine #33972
Closed
@holtkamp

Description

@holtkamp

Description
Currently it is possible to instantiate an "invalid" StateMachine. It would be nice to have some checks in place to prevent this.

Example
For example:

<?php

use Symfony\Component\Workflow\Definition;
use Symfony\Component\Workflow\StateMachine;
use Symfony\Component\Workflow\Transition;

$states = ['created', 'activated', 'deleted'];
$stateTransitions = [
    new Transition('activate', 'created', 'activated'),
    new Transition('activate', 'created', 'deleted'), //oops, copy-paste mistake: 'activate' should have been 'delete'
];
$definition = new Definition($states, $stateTransitions);
$stateMachine = new StateMachine($definition);

This would result in an "invalid" StateMachine...

Screenshot 2019-10-13 at 19 25 50

Maybe some inspiration can be derived from this implementation of a StateMachine

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0