izzum\statemachine\State::setEntryCallable PHP Метод

setEntryCallable() публичный Метод

set the entry callable, the callable to be called when entering this state
public setEntryCallable ( callable $callable )
$callable callable
    public function setEntryCallable($callable)
    {
        $this->callable_entry = $callable;
        return $this;
    }

Usage Example

Пример #1
0
 /**
  * @test
  */
 public function shouldEnterWithCallable()
 {
     $state = new State('a');
     $context = new Context(new Identifier('123', 'foo-machine'));
     $event = 'foo';
     $callable = function ($entity) {
         $entity->setEntityId('234');
     };
     $state->setEntryCallable($callable);
     $this->assertEquals('123', $context->getEntityId());
     $state->exitAction($context);
     $this->assertEquals('123', $context->getEntityId());
     $state->entryAction($context);
     $this->assertEquals('234', $context->getEntityId());
 }
All Usage Examples Of izzum\statemachine\State::setEntryCallable