You are here

private static function ContactStorageExportBatches::getMax in Contact Storage Export 8

Get max amount of messages to export.

Parameters

array $settings: The settings from the export form.

int $last_id: The last id exported or 0 if all.

Return value

int The maximum number of messages to export.

1 call to ContactStorageExportBatches::getMax()
ContactStorageExportBatches::processBatch in src/ContactStorageExportBatches.php
Process callback for the batch set the export form.

File

src/ContactStorageExportBatches.php, line 123

Class

ContactStorageExportBatches
Class ContactStorageExportBatches.

Namespace

Drupal\contact_storage_export

Code

private static function getMax(array $settings, $last_id) {
  $query = \Drupal::entityQuery('contact_message');
  $query
    ->condition('contact_form', $settings['contact_form']);
  $query
    ->condition('id', $last_id, '>');
  $query
    ->count();
  $result = $query
    ->execute();
  return $result ? $result : 0;
}