You are here

public function UpdateUtils::setRevisionCreationTime in Scheduled Updates 8

Set revision creation time for entities that support it.

Currently only nodes and entities that use Entity API are supported.

Parameters

\Drupal\Core\Entity\ContentEntityInterface $entity:

Overrides UpdateUtilsInterface::setRevisionCreationTime

File

src/UpdateUtils.php, line 148

Class

UpdateUtils
Service to determine information about Scheduled Update Types.

Namespace

Drupal\scheduled_updates

Code

public function setRevisionCreationTime(ContentEntityInterface $entity) {
  $revision_timestamp_interfaces = [
    'Drupal\\entity\\Revision\\EntityRevisionLogInterface',
    'Drupal\\node\\NodeInterface',
  ];
  if ($this
    ->implementsInterface($entity, $revision_timestamp_interfaces)) {

    /** @var \Drupal\entity\Revision\EntityRevisionLogInterface|\Drupal\node\NodeInterface $entity */
    $entity
      ->setRevisionCreationTime(\Drupal::time()
      ->getRequestTime());
  }
}