protected function Anonymizer::complete in General Data Protection Regulation 7
Complete anonymization routines.
Parameters
GDPRTask $task: The current task being executed.
1 call to Anonymizer::complete()
- Anonymizer::run in modules/
gdpr_tasks/ src/ Anonymizer.php - Runs anonymization routines against a user.
File
- modules/
gdpr_tasks/ src/ Anonymizer.php, line 119
Class
- Anonymizer
- Anonymizes or removes field values for GDPR.
Code
protected function complete(GDPRTask $task) {
if (count($this->failures) === 0) {
$tx = db_transaction();
try {
/* @var EntityInterface $entity */
foreach ($this->successes as $entity_type => $entities) {
foreach ($entities as $entity) {
entity_save($entity_type, $entity);
}
}
// Re-fetch the user so we see any changes that were made.
$user = entity_load_unchanged('user', $task->user_id);
user_save($user, array(
'status' => 0,
));
// @todo Write a log to file system.
} catch (\Exception $e) {
$tx
->rollback();
$this->errors[] = $e
->getMessage();
}
}
}