PHP Class izzum\statemachine\Identifier
A statemachine is always uniquely identified by the combination of an entity
id and a machine name (that provides the relation to the statemachine the
entity is governed by).
the machine name should be a 'machine readable' string, since it will be stored in different
backends and might be used as a key there (eg: in redis).
The entity id is something that uniquely identifies a domain model. Probably
something that is stored in your application, like a primary key in a table, a GUID or a hash.
This object thus stores the minimum data needed from other processes in your
application domain to succesfully work with the statemachine.
Mostra file
Open project: rolfvreijdenberger/izzum-statemachine
Class Usage Examples
Protected Properties
Property |
Type |
Description |
|
$entity_id |
string |
an entity id that represents the unique identifier for an application
domain specific object (entity) like 'Order', 'Customer' etc. |
|
$machine_name |
string |
this is the name of the statemachine itself and is used in conjunction
with the entity_id to define what a statemachine is about. |
|
Public Methods
Method |
Description |
|
__construct ( mixed $entity_id, string $machine_name ) |
Constructor |
|
__toString ( ) : string |
|
|
getEntityId ( ) : string |
gets the entity id that represents the unique identifier for the
application domain specific model. |
|
getId ( boolean $readable = false ) : string |
get the unique identifier representation for an Identifier, which
consists of the machine name and the entity_id in parseable form. |
|
getMachine ( ) : string |
gets the statemachine name that handles the entity |
|
setEntityId ( mixed $entity_id ) |
set the id of the domain specific entity (it will internally be converted to a string) |
|
toString ( ) : string |
|
|
Method Details
__construct()
public method
public __construct ( mixed $entity_id, string $machine_name ) |
$entity_id |
mixed |
the id of the domain specific entity (it will internally be
converted to a string) |
$machine_name |
string |
the name of the statemachine (eg: 'order') |
__toString()
public method
getEntityId()
public method
gets the entity id that represents the unique identifier for the
application domain specific model.
get the unique identifier representation for an Identifier, which
consists of the machine name and the entity_id in parseable form.
getMachine()
public method
gets the statemachine name that handles the entity
setEntityId()
public method
set the id of the domain specific entity (it will internally be converted to a string)
Property Details
$entity_id protected_oe property
an entity id that represents the unique identifier for an application
domain specific object (entity) like 'Order', 'Customer' etc.
protected string $entity_id |
return |
string |
|
$machine_name protected_oe property
this is the name of the statemachine itself and is used in conjunction
with the entity_id to define what a statemachine is about.
protected string $machine_name |
return |
string |
|