private function AnonymizeRecords::processBatch in Library 8
Process batch.
Parameters
array $items: Items to anonymize.
1 call to AnonymizeRecords::processBatch()
- AnonymizeRecords::anonymize in src/
AnonymizeRecords.php - Anonymize entry.
File
- src/
AnonymizeRecords.php, line 114
Class
- AnonymizeRecords
- Anonymize records helper.
Namespace
Drupal\libraryCode
private function processBatch(array $items) : void {
$results = [];
foreach ($items as $item) {
$transactions = $this->transactionStorage
->getQuery()
->Exists('uid')
->condition('library_item', $item)
->execute();
/** @var \Drupal\library\Entity\LibraryTransaction[] $transactionEntities */
$transactionEntities = $this->transactionStorage
->loadMultiple($transactions);
foreach ($transactionEntities as $transaction) {
$transaction
->set('uid', NULL);
$results[] = $transaction
->save();
}
}
if ($results) {
$this->logger
->notice('@count transactions anonymized.', [
'@count' => count($results),
]);
}
}