You are here

public function GatsbyEntityLogger::deleteExpiredLoggedEntities in Gatsby Live Preview & Incremental Builds 8

Same name and namespace in other branches
  1. 2.0.x modules/gatsby_fastbuilds/src/GatsbyEntityLogger.php \Drupal\gatsby_fastbuilds\GatsbyEntityLogger::deleteExpiredLoggedEntities()

Deletes old or expired existing logged entities based on timestamp.

Parameters

int $timestamp: The entity uuid to delete the log entries for.

File

modules/gatsby_fastbuilds/src/GatsbyEntityLogger.php, line 168

Class

GatsbyEntityLogger
Defines a service for logging content entity changes using log entities.

Namespace

Drupal\gatsby_fastbuilds

Code

public function deleteExpiredLoggedEntities($timestamp) {
  $query = $this->entityTypeManager
    ->getStorage('gatsby_log_entity')
    ->getQuery()
    ->accessCheck(FALSE);
  $entity_uuids = $query
    ->condition('created', $timestamp, '<')
    ->execute();
  $entities = $this->entityTypeManager
    ->getStorage('gatsby_log_entity')
    ->loadMultiple($entity_uuids);
  foreach ($entities as $entity) {
    $entity
      ->delete();
  }
}