You are here

public static function AdminUninstallForm::deletePrivateMessageDeleteTimes in Private Message 8

Same name and namespace in other branches
  1. 8.2 src/Form/AdminUninstallForm.php \Drupal\private_message\Form\AdminUninstallForm::deletePrivateMessageDeleteTimes()

Batch callback to delete private message delete times.

File

src/Form/AdminUninstallForm.php, line 99

Class

AdminUninstallForm
Definest he admin uninstall form for the Private Message module.

Namespace

Drupal\private_message\Form

Code

public static function deletePrivateMessageDeleteTimes(&$context) {
  $delete_time_ids = \Drupal::entityQuery('pm_thread_delete_time')
    ->range(0, 100)
    ->execute();
  $storage = \Drupal::entityManager()
    ->getStorage('pm_thread_delete_time');
  if ($delete_times = $storage
    ->loadMultiple($delete_time_ids)) {
    $storage
      ->delete($delete_times);
  }
  $context['finished'] = (int) count($delete_times) < 100;
}