You are here

public function DefaultDateRecurOccurrenceHandler::onDeleteRevision in Recurring Dates Field 8

React when a field item revision is deleted.

Overrides DateRecurOccurrenceHandlerInterface::onDeleteRevision

File

src/Plugin/DateRecurOccurrenceHandler/DefaultDateRecurOccurrenceHandler.php, line 257

Class

DefaultDateRecurOccurrenceHandler
Provides the default occurrence handler.

Namespace

Drupal\date_recur\Plugin\DateRecurOccurrenceHandler

Code

public function onDeleteRevision() {
  $table_name = $this
    ->getOccurrenceCacheStorageTableName($this->item
    ->getFieldDefinition()
    ->getFieldStorageDefinition());
  $q = $this->database
    ->delete($table_name);
  $q
    ->condition('entity_id', $this->item
    ->getEntity()
    ->id());
  $q
    ->condition('revision_id', $this->item
    ->getEntity()
    ->getRevisionId());
  $q
    ->execute();
}