public function System::createItem

Implements Drupal\Core\Queue\QueueInterface::createItem().

Overrides QueueInterface::createItem

File

drupal/core/lib/Drupal/Core/Queue/System.php, line 34
Definition of Drupal\Core\Queue\System.

Class

System
Default queue implementation.

Namespace

Drupal\Core\Queue

Code

public function createItem($data) {

  // During a Drupal 6.x to 8.x update, drupal_get_schema() does not contain
  // the queue table yet, so we cannot rely on drupal_write_record().
  $query = db_insert('queue')
    ->fields(array(
    'name' => $this->name,
    'data' => serialize($data),
    // We cannot rely on REQUEST_TIME because many items might be created
    // by a single request which takes longer than 1 second.
    'created' => time(),
  ));
  return (bool) $query
    ->execute();
}