function ContentEntityStorageBase::getLatestTranslationAffectedRevisionId
Returns the latest revision affecting the specified translation.
Parameters
int|string $entity_id: The entity identifier.
string $langcode: The language code of the translation.
Return value
int|string|null A revision ID or NULL if no revision affecting the specified translation could be found.
Overrides TranslatableRevisionableStorageInterface::getLatestTranslationAffectedRevisionId
File
- 
              core/lib/ Drupal/ Core/ Entity/ ContentEntityStorageBase.php, line 499 
Class
- ContentEntityStorageBase
- Base class for content entity storage handlers.
Namespace
Drupal\Core\EntityCode
public function getLatestTranslationAffectedRevisionId($entity_id, $langcode) {
  if (!$this->entityType
    ->isRevisionable()) {
    return NULL;
  }
  if (!$this->entityType
    ->isTranslatable()) {
    return $this->getLatestRevisionId($entity_id);
  }
  if (!isset($this->latestRevisionIds[$entity_id][$langcode])) {
    $result = $this->getQuery()
      ->allRevisions()
      ->condition($this->entityType
      ->getKey('id'), $entity_id)
      ->condition($this->entityType
      ->getKey('revision_translation_affected'), 1, '=', $langcode)
      ->range(0, 1)
      ->sort($this->entityType
      ->getKey('revision'), 'DESC')
      ->accessCheck(FALSE)
      ->execute();
    $this->latestRevisionIds[$entity_id][$langcode] = key($result);
  }
  return $this->latestRevisionIds[$entity_id][$langcode];
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
