function DatabaseBackendFactory::__construct

Same name in other branches
  1. 9 core/lib/Drupal/Core/Cache/DatabaseBackendFactory.php \Drupal\Core\Cache\DatabaseBackendFactory::__construct()
  2. 8.9.x core/lib/Drupal/Core/Cache/DatabaseBackendFactory.php \Drupal\Core\Cache\DatabaseBackendFactory::__construct()
  3. 11.x core/lib/Drupal/Core/Cache/DatabaseBackendFactory.php \Drupal\Core\Cache\DatabaseBackendFactory::__construct()

Constructs the DatabaseBackendFactory object.

Parameters

\Drupal\Core\Database\Connection $connection: Database connection

\Drupal\Core\Cache\CacheTagsChecksumInterface $checksum_provider: The cache tags checksum provider.

\Drupal\Core\Site\Settings $settings: (optional) The site settings.

\Drupal\Component\Serialization\ObjectAwareSerializationInterface|null $serializer: (optional) The serializer to use.

\Drupal\Component\Datetime\TimeInterface|null $time: The time service.

Throws

\BadMethodCallException

File

core/lib/Drupal/Core/Cache/DatabaseBackendFactory.php, line 42

Class

DatabaseBackendFactory

Namespace

Drupal\Core\Cache

Code

public function __construct(Connection $connection, CacheTagsChecksumInterface $checksum_provider, ?Settings $settings = NULL, ?ObjectAwareSerializationInterface $serializer = NULL, ?TimeInterface $time = NULL) {
    $this->connection = $connection;
    $this->checksumProvider = $checksum_provider;
    if ($this->settings === NULL) {
        @trigger_error('Calling ' . __METHOD__ . ' without the $settings argument is deprecated in drupal:10.3.0 and it will be required in drupal:11.0.0. See https://www.drupal.org/node/3014684', E_USER_DEPRECATED);
        $this->settings = Settings::getInstance();
    }
    if ($this->serializer === NULL) {
        @trigger_error('Calling ' . __METHOD__ . ' without the $serializer argument is deprecated in drupal:10.3.0 and it will be required in drupal:11.0.0. See https://www.drupal.org/node/3014684', E_USER_DEPRECATED);
        $this->serializer = \Drupal::service('serialization.phpserialize');
    }
    if ($this->time === NULL) {
        @trigger_error('Calling ' . __METHOD__ . '() without the $time argument is deprecated in drupal:10.3.0 and it will be required in drupal:11.0.0. See https://www.drupal.org/node/3387233', E_USER_DEPRECATED);
        $this->time = \Drupal::service(TimeInterface::class);
    }
}

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