You are here

public function ScheduledTransitionsUtility::getTransitions in Scheduled Transitions 8

Same name and namespace in other branches
  1. 2.x src/ScheduledTransitionsUtility.php \Drupal\scheduled_transitions\ScheduledTransitionsUtility::getTransitions()

Get scheduled transitions for an entity.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: An entity.

Return value

\Drupal\scheduled_transitions\Entity\ScheduledTransitionInterface[] An array of scheduled transitions.

Overrides ScheduledTransitionsUtilityInterface::getTransitions

File

src/ScheduledTransitionsUtility.php, line 86

Class

ScheduledTransitionsUtility
Utilities for Scheduled Transitions module.

Namespace

Drupal\scheduled_transitions

Code

public function getTransitions(EntityInterface $entity) : array {
  $transitionStorage = $this->entityTypeManager
    ->getStorage('scheduled_transition');
  $ids = $transitionStorage
    ->getQuery()
    ->condition('entity__target_type', $entity
    ->getEntityTypeId())
    ->condition('entity__target_id', $entity
    ->id())
    ->execute();
  return $transitionStorage
    ->loadMultiple($ids);
}