annotate core/modules/user/src/PrivateTempStoreFactory.php @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents 1fec387a4317
children
rev   line source
Chris@0 1 <?php
Chris@0 2
Chris@0 3 namespace Drupal\user;
Chris@0 4
Chris@14 5 use Drupal\Core\TempStore\PrivateTempStoreFactory as CorePrivateTempStoreFactory;
Chris@14 6
Chris@14 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);
Chris@0 8
Chris@0 9 /**
Chris@0 10 * Creates a PrivateTempStore object for a given collection.
Chris@14 11 *
Chris@14 12 * @deprecated in Drupal 8.5.x, to be removed before Drupal 9.0.0.
Chris@14 13 * Use \Drupal\Core\TempStore\PrivateTempStoreFactory instead.
Chris@14 14 *
Chris@14 15 * @see \Drupal\Core\TempStore\PrivateTempStoreFactory
Chris@14 16 * @see https://www.drupal.org/node/2935639
Chris@0 17 */
Chris@14 18 class PrivateTempStoreFactory extends CorePrivateTempStoreFactory {
Chris@0 19
Chris@0 20 /**
Chris@0 21 * Creates a PrivateTempStore.
Chris@0 22 *
Chris@0 23 * @param string $collection
Chris@0 24 * The collection name to use for this key/value store. This is typically
Chris@0 25 * a shared namespace or module name, e.g. 'views', 'entity', etc.
Chris@0 26 *
Chris@0 27 * @return \Drupal\user\PrivateTempStore
Chris@0 28 * An instance of the key/value store.
Chris@0 29 */
Chris@0 30 public function get($collection) {
Chris@0 31 // Store the data for this collection in the database.
Chris@0 32 $storage = $this->storageFactory->get("user.private_tempstore.$collection");
Chris@0 33 return new PrivateTempStore($storage, $this->lockBackend, $this->currentUser, $this->requestStack, $this->expire);
Chris@0 34 }
Chris@0 35
Chris@0 36 }