You are here

public function DefaultDateRecurOccurrenceHandler::onDelete in Recurring Dates Field 8

React when a field item is deleted.

Overrides DateRecurOccurrenceHandlerInterface::onDelete

File

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

Class

DefaultDateRecurOccurrenceHandler
Provides the default occurrence handler.

Namespace

Drupal\date_recur\Plugin\DateRecurOccurrenceHandler

Code

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