public function SpoolStorage::addMail in Simplenews 8
Same name and namespace in other branches
- 8.2 src/Spool/SpoolStorage.php \Drupal\simplenews\Spool\SpoolStorage::addMail()
- 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:
- nid
- tid
- status: (optional) Defaults to SpoolStorageInterface::STATUS_PENDING
- time: (optional) Defaults to REQUEST_TIME.
Overrides SpoolStorageInterface::addMail
File
- src/
Spool/ SpoolStorage.php, line 266
Class
- SpoolStorage
- Default database spool storage.
Namespace
Drupal\simplenews\SpoolCode
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();
}