You are here

protected function MongodbUserData::getQuery in MongoDB 8

Parameters

$args: A list of $module, $uid, $name

Return value

array

2 calls to MongodbUserData::getQuery()
MongodbUserData::delete in mongodb_user/src/MongodbUserData.php
Deletes data stored for a user account.
MongodbUserData::get in mongodb_user/src/MongodbUserData.php
Returns data stored for a user account.

File

mongodb_user/src/MongodbUserData.php, line 118
Contains \Drupal\mongodb_user\MongodbUserData.

Class

MongodbUserData

Namespace

Drupal\mongodb_user

Code

protected function getQuery($args) {
  $query = [];
  foreach ([
    'module',
    'uid',
    'name',
  ] as $i => $field) {
    if (isset($args[$i])) {
      $x = $args[$i];
      $query[$field] = is_array($x) ? [
        '$in' => $x,
      ] : $x;
    }
  }
  return $query;
}