Skip to content

Defining possible states outside of the Model #244

Answered by antback
antback asked this question in Q&A
Discussion options

You must be logged in to vote

Hi,

If anyone needs to provide this same functionality, this is the approach that we have followed:

config/statemachine.php

<?php

return [
    'application' => [
        'events_class' => 'App\State\ApplicationState\Events\ApplicationStateChanged',
        'places' => [
            'App\State\ApplicationState\Places\PendingState', 
            'App\State\ApplicationState\Places\SearchingState', 
            'App\State\ApplicationState\Places\SearchFailedState'
        ],
        'initial_place' => 'App\State\ApplicationState\Places\PendingState', // defaults to the first place if omitted
        'transitions' => [
            'App\State\ApplicationState\Transitions\PendingToSearching' =>…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by antback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant