Backup of db before drupal security update
[yaffs-website] / web / core / lib / Drupal / Core / KeyValueStore / KeyValueDatabaseFactory.php
1 <?php
2
3 namespace Drupal\Core\KeyValueStore;
4
5 use Drupal\Component\Serialization\SerializationInterface;
6 use Drupal\Core\Database\Connection;
7
8 /**
9  * Defines the key/value store factory for the database backend.
10  */
11 class KeyValueDatabaseFactory implements KeyValueFactoryInterface {
12
13   /**
14    * The serialization class to use.
15    *
16    * @var \Drupal\Component\Serialization\SerializationInterface
17    */
18   protected $serializer;
19
20   /**
21    * The database connection to use.
22    *
23    * @var \Drupal\Core\Database\Connection
24    */
25   protected $connection;
26
27   /**
28    * Constructs this factory object.
29    *
30    * @param \Drupal\Component\Serialization\SerializationInterface $serializer
31    *   The serialization class to use.
32    * @param \Drupal\Core\Database\Connection $connection
33    *   The Connection object containing the key-value tables.
34    */
35   public function __construct(SerializationInterface $serializer, Connection $connection) {
36     $this->serializer = $serializer;
37     $this->connection = $connection;
38   }
39
40   /**
41    * {@inheritdoc}
42    */
43   public function get($collection) {
44     return new DatabaseStorage($collection, $this->serializer, $this->connection);
45   }
46
47 }