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
];
См. также: IStatusIdConverter
Наследование: extends yii\base\Object, implements raoul2000\workflow\base\IStatusIdConverter
Показать файл Открыть проект

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

Метод Описание
__construct ( array $config = [] ) Contruct an instance of the StatusIdConverter.
getMap ( ) : array
setMap ( array $map ) Replace the convertion map initialized in constructor by the one passed as argument.
toModelAttribute ( $id ) (non-PHPdoc)
toSimpleWorkflow ( $id ) (non-PHPdoc)

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

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

The parameter map must be defined in the configuration array passed as argument. It contains the associative array used to convert statuses.
public __construct ( array $config = [] )
$config array

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

public getMap ( ) : array
Результат array the convertion map used by this converter

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

Replace the convertion map initialized in constructor by the one passed as argument.
public setMap ( array $map )
$map array

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

(non-PHPdoc)
См. также: IStatusIdConverter::toModelAttribute()
public toModelAttribute ( $id )

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

(non-PHPdoc)
См. также: IStatusIdConverter::toSimpleWorkflow()
public toSimpleWorkflow ( $id )