public function DateRecurOccurrences::onEntityDelete in Recurring Dates Field 3.x
Same name and namespace in other branches
- 8.2 src/DateRecurOccurrences.php \Drupal\date_recur\DateRecurOccurrences::onEntityDelete()
- 3.0.x src/DateRecurOccurrences.php \Drupal\date_recur\DateRecurOccurrences::onEntityDelete()
- 3.1.x src/DateRecurOccurrences.php \Drupal\date_recur\DateRecurOccurrences::onEntityDelete()
Respond to a entity deletion.
Parameters
\Drupal\date_recur\Event\DateRecurValueEvent $event: The date recur event.
File
- src/
DateRecurOccurrences.php, line 176
Class
- DateRecurOccurrences
- Manages occurrences tables and the data that populates them.
Namespace
Drupal\date_recurCode
public function onEntityDelete(DateRecurValueEvent $event) : void {
$list = $event
->getField();
$fieldDefinition = $list
->getFieldDefinition();
$tableName = static::getOccurrenceCacheStorageTableName($fieldDefinition
->getFieldStorageDefinition());
$delete = $this->database
->delete($tableName);
/** @var string|int $entityId */
$entityId = $list
->getEntity()
->id();
$delete
->condition('entity_id', (string) $entityId);
$delete
->execute();
}