class PrivateTempStoreFactory

Same name in this branch
  1. 8.9.x core/lib/Drupal/Core/TempStore/PrivateTempStoreFactory.php \Drupal\Core\TempStore\PrivateTempStoreFactory
Same name in other branches
  1. 9 core/lib/Drupal/Core/TempStore/PrivateTempStoreFactory.php \Drupal\Core\TempStore\PrivateTempStoreFactory
  2. 10 core/lib/Drupal/Core/TempStore/PrivateTempStoreFactory.php \Drupal\Core\TempStore\PrivateTempStoreFactory
  3. 11.x core/lib/Drupal/Core/TempStore/PrivateTempStoreFactory.php \Drupal\Core\TempStore\PrivateTempStoreFactory

Creates a PrivateTempStore object for a given collection.

Hierarchy

Expanded class hierarchy of PrivateTempStoreFactory

Deprecated

in drupal:8.5.0 and is removed from drupal:9.0.0. Use \Drupal\Core\TempStore\PrivateTempStoreFactory instead.

See also

\Drupal\Core\TempStore\PrivateTempStoreFactory

https://www.drupal.org/node/2935639

1 string reference to 'PrivateTempStoreFactory'
user.services.yml in core/modules/user/user.services.yml
core/modules/user/user.services.yml
1 service uses PrivateTempStoreFactory
user.private_tempstore in core/modules/user/user.services.yml
Drupal\user\PrivateTempStoreFactory

File

core/modules/user/src/PrivateTempStoreFactory.php, line 18

Namespace

Drupal\user
View source
class PrivateTempStoreFactory extends CorePrivateTempStoreFactory {
    
    /**
     * Creates a PrivateTempStore.
     *
     * @param string $collection
     *   The collection name to use for this key/value store. This is typically
     *   a shared namespace or module name, e.g. 'views', 'entity', etc.
     *
     * @return \Drupal\user\PrivateTempStore
     *   An instance of the key/value store.
     */
    public function get($collection) {
        // Store the data for this collection in the database.
        $storage = $this->storageFactory
            ->get("user.private_tempstore.{$collection}");
        return new PrivateTempStore($storage, $this->lockBackend, $this->currentUser, $this->requestStack, $this->expire);
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
PrivateTempStoreFactory::$currentUser protected property The current user.
PrivateTempStoreFactory::$expire protected property The time to live for items in seconds.
PrivateTempStoreFactory::$lockBackend protected property The lock object used for this data.
PrivateTempStoreFactory::$requestStack protected property The request stack.
PrivateTempStoreFactory::$storageFactory protected property The storage factory creating the backend to store the data.
PrivateTempStoreFactory::get public function Creates a PrivateTempStore. Overrides PrivateTempStoreFactory::get
PrivateTempStoreFactory::__construct public function Constructs a Drupal\Core\TempStore\PrivateTempStoreFactory object.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.