brexis / laravel-workflow

Use the Symfony Workflow component in Laravel
MIT License
280 stars 104 forks source link

Add support for Laravel 7 #80

Open willemo opened 4 years ago

willemo commented 4 years ago

Based on the code in #73, I've created my own branch with some small fixes. This should be backwards compatible with the marking store config and also support a newer format.

Old:

'marking_store' => [
    'type' => 'single_state',
    'arguments' => ['currentPlace'],
],

New:

'marking_store' => [
    'arguments' => [true, 'currentPlace'],
],

You can use my fork by changing your composer.json and running composer update brexis/laravel-workflow:

"require": {
    "brexis/laravel-workflow": "dev-laravel-7-support"
},
"repositories": [
    {
        "type": "vcs",
        "url": "git@github.com:willemo/laravel-workflow.git"
    }
]
willemo commented 4 years ago

A slight warning for people wanting to update to this version: the subjects for the workflows need to have getters and setters for the marking. So if you have a model that has a state property you use to store the current place of the workflow, you need to add the getState() and setState($state) methods to that model.