PHP Класс raoul2000\workflow\base\StatusIdConverter
The conversion is based on an array where key are valid status ID from the simpleWorkflow
behavior point of view, and values are status ID suitable to be stored in the owner model.
A typical usage for this converter is when the definition of the status column in the underlying table
is not able to store a string value and when modifying column type is not an option. If
for instance the status column type is integer, then the following example conversion table
could be used :
$map = [
'post/new' => 12,
'post/corrected' => 25,
'post/published' => 1,
'post/archived' => 6,
StatusIdConverter::VALUE_NULL => 'some value',
'workflow/Status' => StatusIdConverter::VALUE_NULL
]
Note that if the NULL value must be part of the conversion, you should use the VALUE_NULL
constant instead of the actual 'null' value.
For example in the conversion table below, the fact for the owner model to be outside a workflow,
would mean that the actual status column would be set to 25. In the same way, any model with a
status column equals to NULL, is considered as being in status 'post/toDelete' :
$map = [
StatusIdConverter::VALUE_NULL => 25,
'post/toDelete' => StatusIdConverter::VALUE_NULL
];
Показать файл
Открыть проект
Открытые методы
Описание методов
__construct()
публичный Метод
The parameter map must be defined in the configuration array passed as argument. It contains the
associative array used to convert statuses.
public getMap ( ) : array |
Результат |
array |
the convertion map used by this converter |
Replace the convertion map initialized in constructor by the one passed as argument.
toModelAttribute()
публичный Метод
toSimpleWorkflow()
публичный Метод