raoul2000\workflow\base\SimpleWorkflowBehavior::getEventSequence PHP Метод

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

The event list returned by this method depends on the event sequence component that was configured for this behavior at construction time.
public getEventSequence ( string $status ) : WorkflowEvent[]
$status string the target status
Результат raoul2000\workflow\events\WorkflowEvent[] The list of events
    public function getEventSequence($status)
    {
        list(, , $events) = $this->createTransitionItems($status, false, true);
        return $events;
    }

Usage Example

Пример #1
0
 /**
  * Checks if a given status is a valid transition from the current status
  *
  * @param BaseActiveRecord|SimpleWorkflowBehavior $model
  * @param string $status_id
  * @return bool
  */
 public static function isValidNextStatus($model, $status_id)
 {
     $eventSequence = $model->getEventSequence($status_id);
     foreach ($eventSequence['before'] as $event) {
         if ($model->hasEventHandlers($event->name)) {
             $model->trigger($event->name, $event);
             if ($event->isValid === false) {
                 return false;
             }
         }
     }
     return true;
 }