You are here

public function GatsbyEntityLogger::deleteLoggedEntity in Gatsby Live Preview & Incremental Builds 2.0.x

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

Deletes existing entities based on uuid.

Parameters

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

string $langcode: The entity langcode.

2 calls to GatsbyEntityLogger::deleteLoggedEntity()
GatsbyEntityLogger::logEntity in modules/gatsby_fastbuilds/src/GatsbyEntityLogger.php
Logs an entity create, update, or delete.
GatsbyEntityLogger::logEntityWithRelationships in modules/gatsby_fastbuilds/src/GatsbyEntityLogger.php
Logs an entity create/update/delete and includes all related entity data.

File

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

Class

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

Namespace

Drupal\gatsby_fastbuilds

Code

public function deleteLoggedEntity($uuid, $langcode = 'en') {
  $query = $this->entityTypeManager
    ->getStorage('gatsby_log_entity')
    ->getQuery()
    ->accessCheck(FALSE);
  $entity_uuids = $query
    ->condition('entity_uuid', $uuid)
    ->condition('langcode', $langcode)
    ->execute();
  $entities = $this->entityTypeManager
    ->getStorage('gatsby_log_entity')
    ->loadMultiple($entity_uuids);
  foreach ($entities as $entity) {
    $entity
      ->delete();
  }
}