21d6bd1c4af8c65112c56d4c79ba47631e8b78a5
[yaffs-website] / web / core / modules / user / src / PrivateTempStoreFactory.php
1 <?php
2
3 namespace Drupal\user;
4
5 use Drupal\Core\TempStore\PrivateTempStoreFactory as CorePrivateTempStoreFactory;
6
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);
8
9 /**
10  * Creates a PrivateTempStore object for a given collection.
11  *
12  * @deprecated in Drupal 8.5.x, to be removed before Drupal 9.0.0.
13  *   Use \Drupal\Core\TempStore\PrivateTempStoreFactory instead.
14  *
15  * @see \Drupal\Core\TempStore\PrivateTempStoreFactory
16  * @see https://www.drupal.org/node/2935639
17  */
18 class PrivateTempStoreFactory extends CorePrivateTempStoreFactory {
19
20   /**
21    * Creates a PrivateTempStore.
22    *
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.
26    *
27    * @return \Drupal\user\PrivateTempStore
28    *   An instance of the key/value store.
29    */
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);
34   }
35
36 }