public function ApiDoc::preSaveRevision in Apigee API Catalog 8
Same name and namespace in other branches
- 8.2 src/Entity/ApiDoc.php \Drupal\apigee_api_catalog\Entity\ApiDoc::preSaveRevision()
Acts on a revision before it gets saved.
Parameters
EntityStorageInterface $storage: The entity storage object.
object $record: The revision object.
Overrides ContentEntityBase::preSaveRevision
File
- src/
Entity/ ApiDoc.php, line 174
Class
- ApiDoc
- Defines the API Doc entity.
Namespace
Drupal\apigee_api_catalog\EntityCode
public function preSaveRevision(EntityStorageInterface $storage, \stdClass $record) {
parent::preSaveRevision($storage, $record);
if (!$this
->isNewRevision() && isset($this->original) && empty($record->revision_log_message)) {
// If we are updating an existing entity without adding a new revision, we
// need to make sure $entity->revision_log_message is reset whenever it is
// empty. Therefore, this code allows us to avoid clobbering an existing
// log entry with an empty one.
$record->revision_log_message = $this->original->revision_log_message->value;
}
}