public function SystemSetQueue::createItem in Queue Unique 7
Same name and namespace in other branches
- 7.2 src/Queue/SystemSetQueue.php \Drupal\queue_unique\Queue\SystemSetQueue::createItem()
File
- src/Queue/SystemSetQueue.php, line 31
- Contains \Drupal\queue_unique\Queue\SystemSetQueue
Class
- SystemSetQueue
Namespace
Drupal\queue_unique\Queue
Code
public function createItem($data) {
$sql = "INSERT INTO {" . static::TABLE_NAME . "} (name, created, data, md5) VALUES (:name, :created, :data, MD5(:md5))";
try {
return (bool) db_query($sql, array(
':name' => $this->name,
':data' => serialize($data),
':created' => time(),
':md5' => $this->name . serialize($data),
));
} catch (\PDOException $e) {
throw new SystemSetQueueException(sprintf('Attempted to insert a duplicated item. (%s).', $e
->getMessage()));
}
}