class KeyValueDatabaseFactory

Defines the key/value store factory for the database backend.

Hierarchy

Expanded class hierarchy of KeyValueDatabaseFactory

1 file declares its use of KeyValueDatabaseFactory
1 string reference to 'KeyValueDatabaseFactory'
core.services.yml in drupal/core/core.services.yml
drupal/core/core.services.yml
1 service uses KeyValueDatabaseFactory

File

drupal/core/lib/Drupal/Core/KeyValueStore/KeyValueDatabaseFactory.php, line 15
Contains Drupal\Core\KeyValueStore\KeyValueDatabaseFactory.

Namespace

Drupal\Core\KeyValueStore
View source
class KeyValueDatabaseFactory {

  /**
   * Constructs this factory object.
   *
   *
   * @param \Drupal\Core\Database\Connection $connection
   *   The Connection object containing the key-value tables.
   */
  function __construct(Connection $connection) {
    $this->connection = $connection;
  }

  /**
   * Constructs a new key/value database storage object for a given collection name.
   *
   * @param string $collection
   *   The name of the collection holding key and value pairs.
   * @param \Drupal\Core\Database\Connection $connection
   *   The connection to run against.
   * @return \Drupal\Core\KeyValueStore\DatabaseStorage
   *   A key/value store implementation for the given $collection.
   */
  public function get($collection) {
    return new DatabaseStorage($collection, $this->connection);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
KeyValueDatabaseFactory::get public function Constructs a new key/value database storage object for a given collection name. 1
KeyValueDatabaseFactory::__construct function Constructs this factory object.