public static function EventEnrollment::preDelete in Open Social 10.3.x
Same name and namespace in other branches
- 8.9 modules/social_features/social_event/src/Entity/EventEnrollment.php \Drupal\social_event\Entity\EventEnrollment::preDelete()
- 10.0.x modules/social_features/social_event/src/Entity/EventEnrollment.php \Drupal\social_event\Entity\EventEnrollment::preDelete()
- 10.1.x modules/social_features/social_event/src/Entity/EventEnrollment.php \Drupal\social_event\Entity\EventEnrollment::preDelete()
- 10.2.x modules/social_features/social_event/src/Entity/EventEnrollment.php \Drupal\social_event\Entity\EventEnrollment::preDelete()
Acts on entities before they are deleted and before hooks are invoked.
Used before the entities are deleted and before invoking the delete hook.
Parameters
\Drupal\Core\Entity\EntityStorageInterface $storage: The entity storage object.
\Drupal\Core\Entity\EntityInterface[] $entities: An array of entities.
Overrides EntityBase::preDelete
File
- modules/
social_features/ social_event/ src/ Entity/ EventEnrollment.php, line 89
Class
- EventEnrollment
- Defines the Event enrollment entity.
Namespace
Drupal\social_event\EntityCode
public static function preDelete(EntityStorageInterface $storage, array $entities) {
if (!empty($entities)) {
$tags = [];
foreach ($entities as $enrollment) {
$tags = [
'event_content_list:user:' . $enrollment
->getAccount(),
'event_enrollment_list:' . $enrollment
->getFieldValue('field_event', 'target_id'),
];
}
Cache::invalidateTags($tags);
}
}