You are here

private function DepcalcCacheBackend::getProperties in Dependency Calculation 8

Get the DatabaseBackend instance's database connection.

We don't want to get our own database connection or cache bin, so we just reflect it out of the object we're decorating.

Parameters

\Drupal\Core\Cache\DatabaseBackend $backend: The database backend object from which to extract necessary properties.

Throws

\ReflectionException

1 call to DepcalcCacheBackend::getProperties()
DepcalcCacheBackend::__construct in src/Cache/DepcalcCacheBackend.php
DepcalcCacheBackend constructor.

File

src/Cache/DepcalcCacheBackend.php, line 84

Class

DepcalcCacheBackend
Class DepcalcCacheBackend

Namespace

Drupal\depcalc\Cache

Code

private function getProperties(DatabaseBackend $backend) : void {
  $r = new \ReflectionObject($backend);
  $p = $r
    ->getProperty('connection');
  $p
    ->setAccessible(TRUE);
  $this->connection = $p
    ->getValue($backend);
  $p = $r
    ->getProperty('bin');
  $p
    ->setAccessible(TRUE);
  $this->bin = $p
    ->getValue($backend);
}