You are here

public function SpoolStorage::addMail in Simplenews 8

Same name and namespace in other branches
  1. 8.2 src/Spool/SpoolStorage.php \Drupal\simplenews\Spool\SpoolStorage::addMail()
  2. 3.x src/Spool/SpoolStorage.php \Drupal\simplenews\Spool\SpoolStorage::addMail()

Save mail message in mail cache table.

Parameters

array $spool: The message to be stored in the spool table, as an array containing the following keys:

Overrides SpoolStorageInterface::addMail

File

src/Spool/SpoolStorage.php, line 266

Class

SpoolStorage
Default database spool storage.

Namespace

Drupal\simplenews\Spool

Code

public function addMail(array $spool) {
  $status = isset($spool['status']) ? $spool['status'] : SpoolStorageInterface::STATUS_PENDING;
  $time = isset($spool['time']) ? $spool['time'] : REQUEST_TIME;
  $this->connection
    ->insert('simplenews_mail_spool')
    ->fields(array(
    'mail' => $spool['mail'],
    'entity_type' => $spool['entity_type'],
    'entity_id' => $spool['entity_id'],
    'newsletter_id' => $spool['newsletter_id'],
    'snid' => $spool['snid'],
    'status' => $status,
    'timestamp' => $time,
    'data' => serialize($spool['data']),
  ))
    ->execute();
}