PHP Class raoul2000\workflow\events\WorkflowEvent

Inheritance: extends yii\base\ModelEvent
ファイルを表示 Open project: raoul2000/yii2-workflow Class Usage Examples

Public Methods

Method Description
__construct ( string $name, array $config = [] ) Create a WorkflowEvent instance.
afterChangeStatus ( string $start, string $end ) : string Create name for a *after change status* event.
afterEnterStatus ( string $status = self::ANY_STATUS ) : string Create name for a *after enter status* event.
afterEnterWorkflow ( string $workflowId = self::ANY_WORKFLOW ) : string Create name for a *after enter workflow* event.
afterLeaveStatus ( string $status = self::ANY_STATUS ) : string Create name for a *after leave status* event.
afterLeaveWorkflow ( string $workflowId = self::ANY_WORKFLOW ) : string Create name for a *after leave workflow* event.
beforeChangeStatus ( string $start, string $end ) : string Create name for a *before change status* event.
beforeEnterStatus ( string $status = self::ANY_STATUS ) : string Create name for a *before enter status* event.
beforeEnterWorkflow ( string $workflowId = self::ANY_WORKFLOW ) : string Create name for a *before enter workflow* event.
beforeLeaveStatus ( string $status = self::ANY_STATUS ) : string Create name for a *before leave status* event.
beforeLeaveWorkflow ( string $workflowId = self::ANY_WORKFLOW ) : string Create name for a *before leave workflow* event.
getEndStatus ( ) : Status Get the final status reached by the model when this event occured.
getErrors ( ) : string[] Returns an array containg all error messages.
getStartStatus ( ) : Status Get the status the model what into before this event occured.
getTransition ( ) : raoul2000\workflow\Transition Get the transition concerned by this event.
invalidate ( string $message = null, boolean $handled = false ) Invalidate this event.

Private Methods

Method Description
_checkNonEmptyString ( mixed $argName, mixed $argValue ) Test if $argValue is empty.

Method Details

__construct() public method

Create a WorkflowEvent instance.
public __construct ( string $name, array $config = [] )
$name string name of the event.
$config array configuration array that may contain following keys : 'start', 'end', 'transition'

afterChangeStatus() public static method

Create name for a *after change status* event.
public static afterChangeStatus ( string $start, string $end ) : string
$start string ID of the status which is at the start of the transition (the status that is left)
$end string ID of the status which is at the end of the transition (the status that is reached)
return string name of the event

afterEnterStatus() public static method

Create name for a *after enter status* event.
public static afterEnterStatus ( string $status = self::ANY_STATUS ) : string
$status string the status name or any status if not set
return string name of the event

afterEnterWorkflow() public static method

Create name for a *after enter workflow* event.
public static afterEnterWorkflow ( string $workflowId = self::ANY_WORKFLOW ) : string
$workflowId string the workflow id or any workflow id if not set
return string name of the event

afterLeaveStatus() public static method

Create name for a *after leave status* event.
public static afterLeaveStatus ( string $status = self::ANY_STATUS ) : string
$status string the status name or any status if not set
return string name of the event

afterLeaveWorkflow() public static method

Create name for a *after leave workflow* event.
public static afterLeaveWorkflow ( string $workflowId = self::ANY_WORKFLOW ) : string
$workflowId string the workflow id or any workflow id if not set
return string name of the event

beforeChangeStatus() public static method

Create name for a *before change status* event.
public static beforeChangeStatus ( string $start, string $end ) : string
$start string ID of the status which is at the start of the transition (the status that is left)
$end string ID of the status which is at the end of the transition (the status that is reached)
return string name of the event

beforeEnterStatus() public static method

Create name for a *before enter status* event.
public static beforeEnterStatus ( string $status = self::ANY_STATUS ) : string
$status string the status name or any status if not set
return string name of the event

beforeEnterWorkflow() public static method

Create name for a *before enter workflow* event.
public static beforeEnterWorkflow ( string $workflowId = self::ANY_WORKFLOW ) : string
$workflowId string the workflow id or any workflow id if not set
return string name of the event

beforeLeaveStatus() public static method

Create name for a *before leave status* event.
public static beforeLeaveStatus ( string $status = self::ANY_STATUS ) : string
$status string the status name or any status if not set
return string name of the event

beforeLeaveWorkflow() public static method

Create name for a *before leave workflow* event.
public static beforeLeaveWorkflow ( string $workflowId = self::ANY_WORKFLOW ) : string
$workflowId string the workflow id or any workflow id if not set
return string name of the event

getEndStatus() public method

In case the model is leaving the workflow, this method returns NULL.
public getEndStatus ( ) : Status
return raoul2000\workflow\base\Status the end status involved in this event

getErrors() public method

An error message can be set by calling the *invalidate()* method.
public getErrors ( ) : string[]
return string[] the list of error messages

getStartStatus() public method

In case the model is entering the workflow, this method returns NULL.
public getStartStatus ( ) : Status
return raoul2000\workflow\base\Status the start status involved in this event

getTransition() public method

Get the transition concerned by this event.
See also: raoul2000\workflow\base\Transition
public getTransition ( ) : raoul2000\workflow\Transition
return raoul2000\workflow\Transition the transition involved in this event or NULL if no transition is available (e.g. EnterWorkflow, LeaveWorkflow)

invalidate() public method

Calling this method is equivalent to setting the *isValid* property to false. Additionnally a message can be added to the internal error message queue. If $handled is set to true, following event handlers that may be installed for this event will not be invoked.
See also: http://www.yiiframework.com/doc-2.0/guide-concept-events.html#event-handler-order
See also: http://www.yiiframework.com/doc-2.0/yii-base-event.html#$handled-detail
public invalidate ( string $message = null, boolean $handled = false )
$message string error message
$handled boolean Whether the event is handled. Defaults to false. When a handler sets this to be true, the event processing will stop and ignore the rest of the uninvoked event handlers.