raoul2000\workflow\events\WorkflowEvent::afterLeaveStatus PHP Method

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
    public static function afterLeaveStatus($status = self::ANY_STATUS)
    {
        self::_checkNonEmptyString('status', $status);
        return 'afterLeaveStatus{' . $status . '}';
    }

Usage Example

 /**
  * Produces the following event sequence when a model changes from status A to status B.
  *
  * - beforeLeaveStatus(*)
  * - beforeLeaveStatus(A)
  * - beforeChangeStatusFrom(A)to(B)
  * - beforeEnterStatus(*)
  * - beforeEnterStatus(B)
  *
  * - afterLeaveStatus(*)
  * - afterLeaveStatus(A)
  * - afterChangeStatusFrom(A)to(B)
  * - afterEnterStatus(*)
  * - afterEnterStatus(B)
  * @see \raoul2000\workflow\events\IEventSequence::createChangeStatusSequence()
  */
 public function createChangeStatusSequence($transition, $sender)
 {
     return ['before' => [new WorkflowEvent(WorkflowEvent::beforeLeaveStatus(), ['start' => $transition->getStartStatus(), 'sender' => $sender]), new WorkflowEvent(WorkflowEvent::beforeLeaveStatus($transition->getStartStatus()->getId()), ['start' => $transition->getStartStatus(), 'sender' => $sender]), new WorkflowEvent(WorkflowEvent::beforeChangeStatus($transition->getStartStatus()->getId(), $transition->getEndStatus()->getId()), ['start' => $transition->getStartStatus(), 'end' => $transition->getEndStatus(), 'transition' => $transition, 'sender' => $sender]), new WorkflowEvent(WorkflowEvent::beforeEnterStatus(), ['end' => $transition->getEndStatus(), 'sender' => $sender]), new WorkflowEvent(WorkflowEvent::beforeEnterStatus($transition->getEndStatus()->getId()), ['end' => $transition->getEndStatus(), 'sender' => $sender])], 'after' => [new WorkflowEvent(WorkflowEvent::afterLeaveStatus(), ['start' => $transition->getStartStatus(), 'sender' => $sender]), new WorkflowEvent(WorkflowEvent::afterLeaveStatus($transition->getStartStatus()->getId()), ['start' => $transition->getStartStatus(), 'sender' => $sender]), new WorkflowEvent(WorkflowEvent::afterChangeStatus($transition->getStartStatus()->getId(), $transition->getEndStatus()->getId()), ['start' => $transition->getStartStatus(), 'end' => $transition->getEndStatus(), 'transition' => $transition, 'sender' => $sender]), new WorkflowEvent(WorkflowEvent::afterEnterStatus(), ['end' => $transition->getEndStatus(), 'sender' => $sender]), new WorkflowEvent(WorkflowEvent::afterEnterStatus($transition->getEndStatus()->getId()), ['end' => $transition->getEndStatus(), 'sender' => $sender])]];
 }