Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. DoctrineDbalStore.php

function DoctrineDbalStore::__construct

List of available options:

  • db_table: The name of the table [default: lock_keys]
  • db_id_col: The column where to store the lock key [default: key_id]
  • db_token_col: The column where to store the lock token [default: key_token]
  • db_expiration_col: The column where to store the expiration [default: key_expiration].

Parameters

Connection|string $connOrUrl A DBAL Connection instance or Doctrine URL:

array $options An associative array of options:

float $gcProbability Probability expressed as floating number between 0 and 1 to clean old locks:

int $initialTtl The expiration delay of locks in seconds:

Throws

InvalidArgumentException When namespace contains invalid characters

InvalidArgumentException When the initial ttl is not valid

File

vendor/symfony/lock/Store/DoctrineDbalStore.php, line 64

Class

DoctrineDbalStore
DbalStore is a PersistingStoreInterface implementation using a Doctrine DBAL connection.

Namespace

Symfony\Component\Lock\Store

Code

public function __construct(Connection|string $connOrUrl, array $options = [], float $gcProbability = 0.01, int $initialTtl = 300) {
    $this->init($options, $gcProbability, $initialTtl);
    if ($connOrUrl instanceof Connection) {
        $this->conn = $connOrUrl;
    }
    else {
        if (!class_exists(DriverManager::class)) {
            throw new InvalidArgumentException('Failed to parse the DSN. Try running "composer require doctrine/dbal".');
        }
        $params = (new DsnParser([
            'db2' => 'ibm_db2',
            'mssql' => 'pdo_sqlsrv',
            'mysql' => 'pdo_mysql',
            'mysql2' => 'pdo_mysql',
            'postgres' => 'pdo_pgsql',
            'postgresql' => 'pdo_pgsql',
            'pgsql' => 'pdo_pgsql',
            'sqlite' => 'pdo_sqlite',
            'sqlite3' => 'pdo_sqlite',
        ]))->parse($connOrUrl);
        $config = new Configuration();
        $config->setSchemaManagerFactory(new DefaultSchemaManagerFactory());
        $this->conn = DriverManager::getConnection($params, $config);
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal