示例#1
0
 public static function createPlace($workflow = null, $logger = null)
 {
     $place = new Place();
     if ($workflow && $logger) {
         $place->setWorkflow($workflow, $logger);
     }
     return $place;
 }
示例#2
0
        }
        $token->setData('autoA', true);
        return true;
    }
}
class NodeB extends Automatic
{
    public function execute(TokenInterface $token)
    {
        if (!$token->getData('autoA')) {
            return false;
        }
        $token->setData('autoB', true);
        return true;
    }
}
$logger = new Logger('test');
$workflow = new Workflow($logger);
// create sequence
$a = new NodeA();
$b = new NodeB();
$place = new Place();
$place->setWorkflow($workflow, $logger);
$workflow->addNode($a, 'a');
$workflow->addNode($place, 'p1');
$workflow->addNode($b, 'b');
$workflow->connectToStart('a');
$workflow->connect('a', 'p1');
$workflow->connect('p1', 'b');
$workflow->connectToFinish('b');
$workflow->accept(new Token());