protected function RngEntityModel::deleteRngEvent in RNG - Events and Registrations 3.x
Same name and namespace in other branches
- 8.2 src/RngEntityModel.php \Drupal\rng\RngEntityModel::deleteRngEvent()
- 8 src/RngEntityModel.php \Drupal\rng\RngEntityModel::deleteRngEvent()
Delete related entities when an event is deleted.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: An RNG event entity.
1 call to RngEntityModel::deleteRngEvent()
- RngEntityModel::hook_entity_predelete in src/
RngEntityModel.php - React to Drupal `hook_entity_predelete` hook.
File
- src/
RngEntityModel.php, line 169
Class
- RngEntityModel
- Enforces RNG model relationships.
Namespace
Drupal\rngCode
protected function deleteRngEvent(EntityInterface $entity) {
// Don't need to catch exception from getMeta(), it is already checked by
// the calling method.
$event_meta = $this->eventManager
->getMeta($entity);
// Delete registrations.
$registrations = $event_meta
->getRegistrations();
$this->registrationStorage
->delete($registrations);
// Delete groups.
$groups = $event_meta
->getGroups();
$this->registrationGroupStorage
->delete($groups);
// Delete rules.
$rules = $event_meta
->getRules(NULL, FALSE, NULL);
$this->ruleStorage
->delete($rules);
}