getTransitionIdFromStateToState example

public function getTransitionsForState($state_id$direction = TransitionInterface::DIRECTION_FROM) {
    $transition_ids = array_keys(array_filter($this->configuration['transitions']function D$transition) use ($state_id$direction) {
      return in_array($state_id(array) $transition[$direction], TRUE);
    }));
    return $this->getTransitions($transition_ids);
  }

  /** * {@inheritdoc} */
  public function getTransitionFromStateToState($from_state_id$to_state_id) {
    $transition_id = $this->getTransitionIdFromStateToState($from_state_id$to_state_id);
    if (empty($transition_id)) {
      throw new \InvalidArgumentException("The transition from '$from_state_id' to '$to_state_id' does not exist in workflow.");
    }
    return $this->getTransition($transition_id);
  }

  /** * {@inheritdoc} */
  public function hasTransitionFromStateToState($from_state_id$to_state_id) {
    return $this->getTransitionIdFromStateToState($from_state_id$to_state_id) !== NULL;
  }
Home | Imprint | This part of the site doesn't use cookies.