You are here

class KeyValueDatabaseFactory in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/KeyValueStore/KeyValueDatabaseFactory.php \Drupal\Core\KeyValueStore\KeyValueDatabaseFactory
  2. 9 core/lib/Drupal/Core/KeyValueStore/KeyValueDatabaseFactory.php \Drupal\Core\KeyValueStore\KeyValueDatabaseFactory

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

Hierarchy

  • class \Drupal\Core\KeyValueStore\KeyValueDatabaseFactory implements \Drupal\Core\KeyValueStore\KeyValueFactoryInterface

Expanded class hierarchy of KeyValueDatabaseFactory

1 file declares its use of KeyValueDatabaseFactory
DatabaseStorageTest.php in core/tests/Drupal/KernelTests/Core/KeyValueStore/DatabaseStorageTest.php
1 string reference to 'KeyValueDatabaseFactory'
core.services.yml in core/core.services.yml
core/core.services.yml
1 service uses KeyValueDatabaseFactory
keyvalue.database in core/core.services.yml
Drupal\Core\KeyValueStore\KeyValueDatabaseFactory

File

core/lib/Drupal/Core/KeyValueStore/KeyValueDatabaseFactory.php, line 11

Namespace

Drupal\Core\KeyValueStore
View source
class KeyValueDatabaseFactory implements KeyValueFactoryInterface {

  /**
   * The serialization class to use.
   *
   * @var \Drupal\Component\Serialization\SerializationInterface
   */
  protected $serializer;

  /**
   * The database connection to use.
   *
   * @var \Drupal\Core\Database\Connection
   */
  protected $connection;

  /**
   * Constructs this factory object.
   *
   * @param \Drupal\Component\Serialization\SerializationInterface $serializer
   *   The serialization class to use.
   * @param \Drupal\Core\Database\Connection $connection
   *   The Connection object containing the key-value tables.
   */
  public function __construct(SerializationInterface $serializer, Connection $connection) {
    $this->serializer = $serializer;
    $this->connection = $connection;
  }

  /**
   * {@inheritdoc}
   */
  public function get($collection) {
    return new DatabaseStorage($collection, $this->serializer, $this->connection);
  }

}

Members