public function MongoDbSessionHandler::write

{@inheritDoc]

File

drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php, line 103

Class

MongoDbSessionHandler
MongoDB session handler

Namespace

Symfony\Component\HttpFoundation\Session\Storage\Handler

Code

public function write($sessionId, $data) {
  $data = array(
    $this->options['id_field'] => $sessionId,
    $this->options['data_field'] => new \MongoBinData($data, \MongoBinData::BYTE_ARRAY),
    $this->options['time_field'] => new \MongoTimestamp(),
  );
  $this
    ->getCollection()
    ->update(array(
    $this->options['id_field'] => $sessionId,
  ), array(
    '$set' => $data,
  ), array(
    'upsert' => true,
  ));
  return true;
}