protected function ScheduledTransitionsEntityHooks::loadByHostEntity in Scheduled Transitions 8
Same name and namespace in other branches
- 2.x src/ScheduledTransitionsEntityHooks.php \Drupal\scheduled_transitions\ScheduledTransitionsEntityHooks::loadByHostEntity()
Load a list of scheduled transitions by host entity.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: Entity.
bool $revision_match: TRUE to match revision too.
Return value
\Drupal\scheduled_transitions\Entity\ScheduledTransitionInterface[] A list of scheduled transitions for the given entity.
2 calls to ScheduledTransitionsEntityHooks::loadByHostEntity()
File
- src/
ScheduledTransitionsEntityHooks.php, line 224
Class
- ScheduledTransitionsEntityHooks
- Entity related hooks for Scheduled Transitions module.
Namespace
Drupal\scheduled_transitionsCode
protected function loadByHostEntity(EntityInterface $entity, bool $revision_match = FALSE) : array {
$transitionStorage = $this->entityTypeManager
->getStorage('scheduled_transition');
$query = $transitionStorage
->getQuery()
->condition('entity.target_id', $entity
->id())
->condition('entity.target_type', $entity
->getEntityTypeId())
->accessCheck(FALSE);
if ($revision_match) {
$query
->condition('entity_revision_id', $entity
->getRevisionId());
}
if ($entity instanceof TranslatableInterface && !$entity
->isDefaultTranslation()) {
$query
->condition('entity_revision_langcode', $entity
->language()
->getId());
}
$ids = $query
->execute();
return $transitionStorage
->loadMultiple($ids);
}