PHP Класс 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.
Автор: Rolf Vreijdenberger
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$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.

Открытые методы

Метод Описание
__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

Описание методов

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

Constructor
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 __toString ( ) : string
Результат string

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

gets the entity id that represents the unique identifier for the application domain specific model.
public getEntityId ( ) : string
Результат string

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

get the unique identifier representation for an Identifier, which consists of the machine name and the entity_id in parseable form.
public getId ( boolean $readable = false ) : string
$readable boolean human readable or not. defaults to false
Результат string

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

gets the statemachine name that handles the entity
public getMachine ( ) : string
Результат string

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

set the id of the domain specific entity (it will internally be converted to a string)
public setEntityId ( mixed $entity_id )
$entity_id mixed

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

public toString ( ) : string
Результат string

Описание свойств

$entity_id защищенное свойство

an entity id that represents the unique identifier for an application domain specific object (entity) like 'Order', 'Customer' etc.
protected string $entity_id
Результат string

$machine_name защищенное свойство

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
Результат string