public function ConfigEntityRevisionsStorage::getLatestPublishedRevisionID in Config Entity Revisions 8
Same name and namespace in other branches
- 1.x src/Entity/Handler/ConfigEntityRevisionsStorage.php \Drupal\config_entity_revisions\Entity\Handler\ConfigEntityRevisionsStorage::getLatestPublishedRevisionID()
Gets the latest published revision ID of the entity.
Parameters
int $config_entity_id: The config entity ID to match.
Return value
int The identifier of the latest published revision of the entity, or NULL if the entity does not have a published revision.
Overrides ConfigEntityRevisionsStorageInterface::getLatestPublishedRevisionID
File
- src/
Entity/ Handler/ ConfigEntityRevisionsStorage.php, line 25
Class
- ConfigEntityRevisionsStorage
- Class SqlConfigEntityRevisionsStorage
Namespace
Drupal\config_entity_revisions\Entity\HandlerCode
public function getLatestPublishedRevisionID($config_entity_id) {
$revision = $this->database
->select("config_entity_revisions_revision", 'c')
->fields('c', [
'revision',
])
->condition($this->entityType
->getKey('id'), $config_entity_id)
->condition('published', TRUE)
->orderby('revision', 'DESC')
->range(0, 1)
->execute()
->fetchField();
return $revision;
}