yii2-workflow Class Reference
  • Namespace
  • Class

Namespaces

  • raoul2000
    • workflow
      • actions
      • base
      • events
      • helpers
      • source
        • file
      • validation

Classes

  • BasicEventSequence
  • ExtendedEventSequence
  • ReducedEventSequence
  • WorkflowEvent

Interfaces

  • IEventSequence

Class WorkflowEvent

WorkflowEvent is the base class for all event fired within a workflow.

yii\base\ModelEvent
Extended by raoul2000\workflow\events\WorkflowEvent
Namespace: raoul2000\workflow\events
Located at events/WorkflowEvent.php

Methods summary

public
# __construct( string $name, array $config = [] )

Create a WorkflowEvent instance.

Create a WorkflowEvent instance.

Parameters

$name
name of the event.
$config
configuration array that may contain following keys : 'start', 'end', 'transition'
public raoul2000\workflow\base\Status
# getStartStatus( )

Get the status the model what into before this event occured. In case the model is entering the workflow, this method returns NULL.

Get the status the model what into before this event occured. In case the model is entering the workflow, this method returns NULL.

Returns

raoul2000\workflow\base\Status
the start status involved in this event
public raoul2000\workflow\base\Status
# getEndStatus( )

Get the final status reached by the model when this event occured. In case the model is leaving the workflow, this method returns NULL.

Get the final status reached by the model when this event occured. In case the model is leaving the workflow, this method returns NULL.

Returns

raoul2000\workflow\base\Status
the end status involved in this event
public raoul2000\workflow\Transition
# getTransition( )

Get the transition concerned by this event.

Get the transition concerned by this event.

Returns

raoul2000\workflow\Transition

the transition involved in this event or NULL if no transition is available (e.g. EnterWorkflow, LeaveWorkflow)

See

raoul2000\workflow\base\Transition
public
# invalidate( boolean $message = null, string $handled = false )

Invalidate this event.

Invalidate this event.

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.

Parameters

$message

$handled 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.

$handled
$message error message

See

http://www.yiiframework.com/doc-2.0/guide-concept-events.html#event-handler-order
http://www.yiiframework.com/doc-2.0/yii-base-event.html#$handled-detail
public string[]
# getErrors( )

Returns an array containg all error messages. An error message can be set by calling the invalidate() method.

Returns an array containg all error messages. An error message can be set by calling the invalidate() method.

Returns

string[]
the list of error messages
public static string
# beforeChangeStatus( string $start, string $end )

Create name for a before change status event.

Create name for a before change status event.

Parameters

$start
ID of the status which is at the start of the transition (the status that is left)
$end
ID of the status which is at the end of the transition (the status that is reached)

Returns

string
name of the event
public static string
# afterChangeStatus( string $start, string $end )

Create name for a after change status event.

Create name for a after change status event.

Parameters

$start
ID of the status which is at the start of the transition (the status that is left)
$end
ID of the status which is at the end of the transition (the status that is reached)

Returns

string
name of the event
public static string
# beforeLeaveStatus( string $status = raoul2000\workflow\events\WorkflowEvent::ANY_STATUS )

Create name for a before leave status event.

Create name for a before leave status event.

Parameters

$status
the status name or any status if not set

Returns

string
name of the event
public static string
# afterLeaveStatus( string $status = raoul2000\workflow\events\WorkflowEvent::ANY_STATUS )

Create name for a after leave status event.

Create name for a after leave status event.

Parameters

$status
the status name or any status if not set

Returns

string
name of the event
public static string
# beforeEnterStatus( string $status = raoul2000\workflow\events\WorkflowEvent::ANY_STATUS )

Create name for a before enter status event.

Create name for a before enter status event.

Parameters

$status
the status name or any status if not set

Returns

string
name of the event
public static string
# afterEnterStatus( string $status = raoul2000\workflow\events\WorkflowEvent::ANY_STATUS )

Create name for a after enter status event.

Create name for a after enter status event.

Parameters

$status
the status name or any status if not set

Returns

string
name of the event
public static string
# beforeEnterWorkflow( string $workflowId = raoul2000\workflow\events\WorkflowEvent::ANY_WORKFLOW )

Create name for a before enter workflow event.

Create name for a before enter workflow event.

Parameters

$workflowId
the workflow id or any workflow id if not set

Returns

string
name of the event
public static string
# afterEnterWorkflow( string $workflowId = raoul2000\workflow\events\WorkflowEvent::ANY_WORKFLOW )

Create name for a after enter workflow event.

Create name for a after enter workflow event.

Parameters

$workflowId
the workflow id or any workflow id if not set

Returns

string
name of the event
public static string
# beforeLeaveWorkflow( string $workflowId = raoul2000\workflow\events\WorkflowEvent::ANY_WORKFLOW )

Create name for a before leave workflow event.

Create name for a before leave workflow event.

Parameters

$workflowId
the workflow id or any workflow id if not set

Returns

string
name of the event
public static string
# afterLeaveWorkflow( string $workflowId = raoul2000\workflow\events\WorkflowEvent::ANY_WORKFLOW )

Create name for a after leave workflow event.

Create name for a after leave workflow event.

Parameters

$workflowId
the workflow id or any workflow id if not set

Returns

string
name of the event

Constants summary

string ANY_STATUS
# '*'
string ANY_WORKFLOW
# '*'
yii2-workflow Class Reference API documentation generated by ApiGen