diff --git a/Neos.Cache/Classes/Backend/PdoBackend.php b/Neos.Cache/Classes/Backend/PdoBackend.php index 99ef0e8dac..d81afc7bde 100644 --- a/Neos.Cache/Classes/Backend/PdoBackend.php +++ b/Neos.Cache/Classes/Backend/PdoBackend.php @@ -47,6 +47,11 @@ class PdoBackend extends IndependentAbstractBackend implements TaggableBackendIn */ protected $password; + /** + * @var array + */ + protected $driverOptions = []; + /** * @var \PDO */ @@ -118,6 +123,18 @@ protected function setPassword(string $password): void $this->password = $password; } + /** + * Sets the driverOptions to use + * + * @param array $driverOptions The options to use for connecting to the DB + * @return void + * @api + */ + protected function setDriverOptions(array $driverOptions): void + { + $this->driverOptions = $driverOptions; + } + /** * Sets the name of the "cache" table * @@ -389,7 +406,7 @@ public function flushByTags(array $tags): int $statementHandle = $this->databaseHandle->prepare('SELECT "identifier" FROM "' . $this->tagsTableName . '" WHERE "context"=? AND "cache"=? AND "tag" IN (' . $tagPlaceholders . ')'); $statementHandle->execute(array_merge([$this->context(), $this->cacheIdentifier], $tagList)); $result = $statementHandle->fetchAll(); - $identifiers[]= array_column($result, 'identifier'); + $identifiers[] = array_column($result, 'identifier'); } $identifiers = array_merge([], ...$identifiers); @@ -501,10 +518,10 @@ protected function connect() throw new Exception(sprintf('Could not create directory for sqlite file "%s"', $splitdsn[1]), 1565359792, $exception); } } - $this->databaseHandle = new \PDO($this->dataSourceName, $this->username, $this->password); + $this->databaseHandle = new \PDO($this->dataSourceName, $this->username, $this->password, $this->driverOptions); $this->createCacheTables(); } else { - $this->databaseHandle = new \PDO($this->dataSourceName, $this->username, $this->password); + $this->databaseHandle = new \PDO($this->dataSourceName, $this->username, $this->password, $this->driverOptions); } $this->databaseHandle->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);