protected function SqlImport::importPersistent in MongoDB 8.2
Import a database persistent KV store.
Parameters
\Drupal\Core\Database\StatementInterface $cursor: A cursor enumerating collections in a database KV store.
1 call to SqlImport::importPersistent()
- SqlImport::import in modules/
mongodb_storage/ src/ Install/ SqlImport.php - The command implementation for most-ikv: import the DB KV to MongoDB.
File
- modules/
mongodb_storage/ src/ Install/ SqlImport.php, line 124
Class
- SqlImport
- Service providing the import of the SQL-based KV storage to MongoDB.
Namespace
Drupal\mongodb_storage\InstallCode
protected function importPersistent(StatementInterface $cursor) {
foreach ($cursor as $row) {
$collection = $row->collection;
/** @var \Drupal\Core\KeyValueStore\KeyValueStoreInterface $dbStore */
$dbStore = $this->persistentDbFactory
->get($collection);
/** @var \Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface $mgStore */
$mgStore = $this->persistentMoFactory
->get($collection);
$mgStore
->deleteAll();
foreach ($dbStore
->getAll() as $key => $value) {
$mgStore
->set($key, $value);
}
}
}