You are here

protected function MongodbSessionHandler::findOne in MongoDB 8

Tries to find a session and an according user.

Parameters

$conditions:

Return value

array|mixed|null

1 call to MongodbSessionHandler::findOne()
MongodbSessionHandler::read in mongodb_user/src/MongodbSessionHandler.php

File

mongodb_user/src/MongodbSessionHandler.php, line 81
Contains \Drupal\mongodb_user\MongodbSessionHandler.

Class

MongodbSessionHandler

Namespace

Drupal\mongodb_user

Code

protected function findOne($conditions) {
  $session = $this
    ->mongoCollection()
    ->findOne($conditions);
  if ($session) {
    $query['values.default_langcode.value'] = 1;
    $query['_id'] = $session['uid'];
    if ($user_record = $this->mongo
      ->get('entity.user')
      ->findOne($query, [
      'session',
    ])) {
      $session += $user_record['session'];
    }
    else {
      $session = FALSE;
    }
  }
  return $session;
}