public function ModerationInformation::getLatestRevisionId in Config Entity Revisions 8.2
Returns the revision ID of the latest revision of the given entity.
Parameters
string $entity_type_id: The entity type ID.
int $entity_id: The entity ID.
Return value
int The revision ID of the latest revision for the specified entity, or NULL if there is no such entity.
Overrides ModerationInformation::getLatestRevisionId
Deprecated
in drupal:8.8.0 and is removed from drupal:9.0.0. Use RevisionableStorageInterface::getLatestRevisionId instead.
See also
https://www.drupal.org/node/3087295
2 calls to ModerationInformation::getLatestRevisionId()
- ModerationInformation::getLatestRevision in src/
ModerationInformation.php - Loads the latest revision of a specific entity.
- ModerationInformation::isLatestRevision in src/
ModerationInformation.php - Determines if an entity is a latest revision.
File
- src/
ModerationInformation.php, line 109
Class
- ModerationInformation
- Class ModerationInformation.
Namespace
Drupal\config_entity_revisionsCode
public function getLatestRevisionId($entity_type_id, $entity_id) {
if ($storage = $this->entityTypeManager
->getStorage($entity_type_id)) {
$result = $storage
->getQuery()
->latestRevision()
->condition($this->entityTypeManager
->getDefinition($entity_type_id)
->getKey('id'), $entity_id)
->accessCheck(FALSE)
->execute();
if ($result) {
return key($result);
}
}
}