PHP Class izzum\statemachine\builder\ModelBuilder

This will thus not build the model when the statemachine asks for it, but rather the model is built when your application code creates it. This class is useful if your domain model actually subclasses the StateMachine class or uses object composition to use the statemachines' logic internally. In that case, you can construct the StateMachine in your models' constructor, including the Context with this class in it and with the domain model itself ($this) as an argument to the builder, so you can put our event handlers on the domain model and have them respond to the statemachine. eg: in the constructor of your domain model that uses object composition $builder = new ModelBuilder($this); $identifier = new Identifier($this->getId(), 'my-model-machine'); $context = new Context($identifier, $builder); $this->machine = new StateMachine($context); eg: in the constructor of your domain model that uses StateMachine as its' superclass $builder = new ModelBuilder($this); $identifier = new Identifier($this->getId(), 'my-model-machine'); $context = new Context($identifier, $builder); parent::__construct($context)
Author: Rolf Vreijdenberger
Inheritance: extends izzum\statemachine\EntityBuilder
Datei anzeigen Open project: rolfvreijdenberger/izzum-statemachine Class Usage Examples

Public Methods

Method Description
__construct ( mixed $model )

Protected Methods

Method Description
build ( Identifier $identifier ) {@inheritDoc}

Method Details

__construct() public method

public __construct ( mixed $model )
$model mixed the domain model you want to have returned from this class.

build() protected method

{@inheritDoc}
protected build ( Identifier $identifier )
$identifier izzum\statemachine\Identifier