You are here

public function EntityRevision::getHighestId in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/migrate/src/Plugin/migrate/destination/EntityRevision.php \Drupal\migrate\Plugin\migrate\destination\EntityRevision::getHighestId()
  2. 9 core/modules/migrate/src/Plugin/migrate/destination/EntityRevision.php \Drupal\migrate\Plugin\migrate\destination\EntityRevision::getHighestId()

Returns the highest ID tracked by the implementing plugin.

Return value

int The highest ID.

Overrides EntityContentBase::getHighestId

File

core/modules/migrate/src/Plugin/migrate/destination/EntityRevision.php, line 197

Class

EntityRevision
Provides entity revision destination plugin.

Namespace

Drupal\migrate\Plugin\migrate\destination

Code

public function getHighestId() {
  $values = $this->storage
    ->getQuery()
    ->accessCheck(FALSE)
    ->allRevisions()
    ->sort($this
    ->getKey('revision'), 'DESC')
    ->range(0, 1)
    ->execute();

  // The array keys are the revision IDs.
  // The array contains only one entry, so we can use key().
  return (int) key($values);
}