yohang / Finite

A Simple PHP Finite State Machine
http://yohan.giarel.li/Finite
MIT License
1.31k stars 188 forks source link

the difference between `-state` and `state` #147

Open ryuuyq opened 5 years ago

ryuuyq commented 5 years ago

below,there is 'from' => '-proposed' and 'from' => 'proposed'.

what is the difference ?

    'callbacks' => array(
        'before' => array(
            array(
                'from' => '-proposed',
                'do' => function(Finite\StatefulInterface $document, \Finite\Event\TransitionEvent $e) {
                    echo 'Applying transition '.$e->getTransition()->getName(), "\n";
                }
            ),
            array(
                'from' => 'proposed',
                'do' => function() {
                    echo 'Applying transition from proposed state', "\n";
                }
            )
        ),
        'after' => array(
            array(
                'to' => array('accepted'), 'do' => array($document, 'display')
            )
        )
    )
imzeali commented 5 years ago

image

tsmgeek commented 5 years ago

Just need some more clarification.

It will apply to all states except that one mentioned? If so how do you add multiple exclusions?