5 use Drupal\Core\TempStore\PrivateTempStoreFactory as CorePrivateTempStoreFactory;
7 @trigger_error('\Drupal\user\PrivateTempStoreFactory is scheduled for removal in Drupal 9.0.0. Use \Drupal\Core\TempStore\PrivateTempStoreFactory instead. See https://www.drupal.org/node/2935639.', E_USER_DEPRECATED);
10 * Creates a PrivateTempStore object for a given collection.
12 * @deprecated in Drupal 8.5.x, to be removed before Drupal 9.0.0.
13 * Use \Drupal\Core\TempStore\PrivateTempStoreFactory instead.
15 * @see \Drupal\Core\TempStore\PrivateTempStoreFactory
16 * @see https://www.drupal.org/node/2935639
18 class PrivateTempStoreFactory extends CorePrivateTempStoreFactory {
21 * Creates a PrivateTempStore.
23 * @param string $collection
24 * The collection name to use for this key/value store. This is typically
25 * a shared namespace or module name, e.g. 'views', 'entity', etc.
27 * @return \Drupal\user\PrivateTempStore
28 * An instance of the key/value store.
30 public function get($collection) {
31 // Store the data for this collection in the database.
32 $storage = $this->storageFactory->get("user.private_tempstore.$collection");
33 return new PrivateTempStore($storage, $this->lockBackend, $this->currentUser, $this->requestStack, $this->expire);