protected function RngEntityModel::deletePerson in RNG - Events and Registrations 8.2
Same name and namespace in other branches
- 8 src/RngEntityModel.php \Drupal\rng\RngEntityModel::deletePerson()
- 3.x src/RngEntityModel.php \Drupal\rng\RngEntityModel::deletePerson()
Delete related entities when a person entity.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: An identity/person entity.
1 call to RngEntityModel::deletePerson()
- RngEntityModel::hook_entity_predelete in src/
RngEntityModel.php - React to Drupal `hook_entity_predelete` hook.
File
- src/
RngEntityModel.php, line 153
Class
- RngEntityModel
- Enforces RNG model relationships.
Namespace
Drupal\rngCode
protected function deletePerson(EntityInterface $entity) {
// Remove registrant references to this identity.
$registrant_ids = Registrant::getRegistrantsIdsForIdentity($entity);
foreach ($this->registrantStorage
->loadMultiple($registrant_ids) as $registrant) {
/** @var \Drupal\rng\Entity\RegistrantInterface $registrant */
$registrant
->clearIdentity();
$registrant
->save();
}
}