2017 © Pedro Peláez
 

symfony-bundle simple-task-fsm-bundle

The SimpleTaskFSMBundle adds the ability to use FSM tasks runner in your application.

image

evheniy/simple-task-fsm-bundle

The SimpleTaskFSMBundle adds the ability to use FSM tasks runner in your application.

  • Wednesday, June 3, 2015
  • by evheniy
  • Repository
  • 2 Watchers
  • 1 Stars
  • 9,002 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

SimpleTaskFSMBundle

This bundle provides the ability to use FSM tasks runner in your application., (*1)

knpbundles.com, (*2)

Latest Stable Version Total Downloads Latest Unstable Version License, (*3)

Scrutinizer Code Quality Build Status, (*4)

Build Status, (*5)

Installation

$ composer require evheniy/simple-task-fsm-bundle "1.*"

Or add to composer.json, (*6)

"evheniy/simple-task-fsm-bundle": "1.*"

AppKernel:, (*7)

public function registerBundles()
{
    $bundles = array(
        ...
        new Evheniy\SimpleTaskFSMBundle\SimpleTaskFSMBundle(),
    );
    ...

Documentation

For using SimpleTaskFSMBundle you need to create state classes., (*8)

For example AppBundle/FSM/StateInit:, (*9)

<?php

namespace AppBundle/FSM;

use Evheniy\SimpleTaskFSMBundle\StateAbstract;

class StateInit extends StateAbstract
{

    /**
     * @throw \Evheniy\SimpleTaskFSMBundle\Exception\StateException
     */
    public function run()
    {
        //do something...
    }
}

Then create FSM manager with this state classes (for example in Command):, (*10)

use Evheniy\SimpleTaskFSMBundle\FSM;

And, (*11)

$fsm = new FSM(array(new StateInit()));
foreach($fsm as $state) {
    $state->run();
}

OR, (*12)

$fsm = new FSM(array(new StateInit()));
$fsm->rewind();
while($fsm->valid()) {
    $fsm->current()->run();
    $fsm->next();
}

If you have exception (You can use Evheniy\SimpleTaskFSMBundle\Exception\StateException) and You need to restart step:, (*13)

$fsm = new FSM(array(new StateWithError()));

$fsm->rewind();
while($fsm->valid()) {
    try {
        $fsm->current()->run();// function run() throws StateException
        $fsm->next();
    } catch (StateException $e) {
        //do something
    }
}

You can use a lot of states and they will run one by one., (*14)

$fsm = new FSM(array(new StateInit(), new StateMainTask(), new StateFinish()));

License

This bundle is under the [MIT][2] license., (*15)

Документация на русском языке, (*16)

The Versions

03/06 2015

dev-master

9999999-dev

The SimpleTaskFSMBundle adds the ability to use FSM tasks runner in your application.

  Sources   Download

MIT

The Requires

 

symfony simple latest fsm tasks finite-state machine

03/06 2015

1.0.0

1.0.0.0

The SimpleTaskFSMBundle adds the ability to use FSM tasks runner in your application.

  Sources   Download

MIT

The Requires

 

symfony simple latest fsm tasks finite-state machine