public static function AdminUninstallForm::deletePrivateMessageThreads in Private Message 8
Same name and namespace in other branches
- 8.2 src/Form/AdminUninstallForm.php \Drupal\private_message\Form\AdminUninstallForm::deletePrivateMessageThreads()
Batch callback to delete private message threads.
File
- src/
Form/ AdminUninstallForm.php, line 123
Class
- AdminUninstallForm
- Definest he admin uninstall form for the Private Message module.
Namespace
Drupal\private_message\FormCode
public static function deletePrivateMessageThreads(&$context) {
$private_message_thread_ids = \Drupal::entityQuery('private_message_thread')
->range(0, 100)
->execute();
$storage = \Drupal::entityManager()
->getStorage('private_message_thread');
if ($private_message_threads = $storage
->loadMultiple($private_message_thread_ids)) {
$storage
->delete($private_message_threads);
}
$context['finished'] = (int) count($private_message_threads) < 100;
}