You are here

public function KeyValueStore::__wakeup in MongoDB 8.2

The __wakeup() method cannot use the container, because its constructor is never invoked, and the container itself must not be serialized.

File

modules/mongodb_storage/src/KeyValueStore.php, line 71

Class

KeyValueStore
Class KeyValueStore provides a KeyValueStore as a MongoDB collection.

Namespace

Drupal\mongodb_storage

Code

public function __wakeup() {

  /** @var \Drupal\mongodb\DatabaseFactory $databaseFactory */
  $dbFactory = \Drupal::service(MongoDb::SERVICE_DB_FACTORY);

  /** @var \MongoDB\Database $database */
  $database = $dbFactory
    ->get(KeyValueFactory::DB_KEYVALUE);
  $this->collection = $database
    ->selectCollection($this->collectionName);
}