public function SpoolStorage::addMail in Simplenews 3.x
Same name and namespace in other branches
- 8.2 src/Spool/SpoolStorage.php \Drupal\simplenews\Spool\SpoolStorage::addMail()
- 8 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:
- entity_type
- entity_id
- newsletter_id
- snid or data
- status: (optional) Defaults to SpoolStorageInterface::STATUS_PENDING
- time: (optional) Defaults to REQUEST_TIME.
Overrides SpoolStorageInterface::addMail
File
- src/
Spool/ SpoolStorage.php, line 287
Class
- SpoolStorage
- Default database spool storage.
Namespace
Drupal\simplenews\SpoolCode
public function addMail(array $spool) {
if (!isset($spool['status'])) {
$spool['status'] = SpoolStorageInterface::STATUS_PENDING;
}
if (!isset($spool['timestamp'])) {
$spool['timestamp'] = REQUEST_TIME;
}
if (isset($spool['data'])) {
$spool['data'] = serialize($spool['data']);
}
$this->connection
->insert('simplenews_mail_spool')
->fields($spool)
->execute();
}