コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public static function executeTransition(WorkflowTransitionInterface $transition, $force = FALSE)
 {
     if ($force) {
         $transition->force($force);
     }
     $update_entity = !$transition->isScheduled() && !$transition->isExecuted();
     // Validate transition, save in history table and delete from schedule table.
     $to_sid = $transition->execute();
     // Save the (scheduled) transition.
     if ($update_entity) {
         if ($to_sid == $transition->getToSid()) {
             // Update the workflow field of the entity.
             $transition->updateTargetEntity();
         } else {
             // The transition was not allowed.
             // @todo: validateForm().
         }
     } else {
         // We create a new transition, or update an existing one.
         // Do not update the entity itself.
     }
     return $to_sid;
 }