You are here

public function WebformScheduledEmailManager::total in Webform 6.x

Same name and namespace in other branches
  1. 8.5 modules/webform_scheduled_email/src/WebformScheduledEmailManager.php \Drupal\webform_scheduled_email\WebformScheduledEmailManager::total()

Get the total number of scheduled emails.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: A webform, webform submission, or source entity.

string|null $handler_id: A webform handler id.

string|null $state: The state of the scheduled emails.

Return value

int The total number of scheduled emails.

Overrides WebformScheduledEmailManagerInterface::total

4 calls to WebformScheduledEmailManager::total()
WebformScheduledEmailManager::queued in modules/webform_scheduled_email/src/WebformScheduledEmailManager.php
Get the number of emails queued but not ready to be sent.
WebformScheduledEmailManager::ready in modules/webform_scheduled_email/src/WebformScheduledEmailManager.php
Get the number of emails ready to be sent during the next cron task.
WebformScheduledEmailManager::stats in modules/webform_scheduled_email/src/WebformScheduledEmailManager.php
Get all the handler's statistics.
WebformScheduledEmailManager::waiting in modules/webform_scheduled_email/src/WebformScheduledEmailManager.php
Get the number of emails waiting to be queued.

File

modules/webform_scheduled_email/src/WebformScheduledEmailManager.php, line 779

Class

WebformScheduledEmailManager
Defines the webform scheduled email manager.

Namespace

Drupal\webform_scheduled_email

Code

public function total(EntityInterface $entity = NULL, $handler_id = NULL, $state = FALSE) {
  list($webform, $webform_submission, $source_entity) = $this
    ->getEntities($entity);
  $query = $this->database
    ->select('webform_scheduled_email', 'w');
  $this
    ->addQueryConditions($query, $webform, $webform_submission, $source_entity, $handler_id, $state);
  return $query
    ->countQuery()
    ->execute()
    ->fetchField();
}