From 9829b13dbfb36b194583f957bde0a5c4c02d85d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jib=C3=A9=20Barth?= Date: Sat, 12 Feb 2022 19:03:35 +0100 Subject: [PATCH] [Lock] Fix code example for Doctrine based stores --- components/lock.rst | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/components/lock.rst b/components/lock.rst index 0d00885b9c2..6660b9c9965 100644 --- a/components/lock.rst +++ b/components/lock.rst @@ -507,11 +507,11 @@ The DoctrineDbalStore saves locks in an SQL database. It is identical to PdoStor but requires a `Doctrine DBAL Connection`_, or a `Doctrine DBAL URL`_. This store does not support blocking, and expects a TTL to avoid stalled locks:: - use Symfony\Component\Lock\Store\PdoStore; + use Symfony\Component\Lock\Store\DoctrineDbalStore; - // a PDO, a Doctrine DBAL connection or DSN for lazy connecting through PDO + // a Doctrine DBAL connection or DSN $connectionOrURL = 'mysql://myuser:mypassword@127.0.0.1/app'; - $store = new PdoStore($connectionOrURL); + $store = new DoctrineDbalStore($connectionOrURL); .. note:: @@ -566,11 +566,11 @@ The DoctrineDbalPostgreSqlStore uses `Advisory Locks`_ provided by PostgreSQL. It is identical to PostgreSqlStore but requires a `Doctrine DBAL Connection`_ or a `Doctrine DBAL URL`_. It supports native blocking, as well as sharing locks:: - use Symfony\Component\Lock\Store\PostgreSqlStore; + use Symfony\Component\Lock\Store\DoctrineDbalPostgreSqlStore; - // a PDO instance or DSN for lazy connecting through PDO - $databaseConnectionOrDSN = 'pgsql:host=localhost;port=5634;dbname=lock'; - $store = new PostgreSqlStore($databaseConnectionOrDSN, ['db_username' => 'myuser', 'db_password' => 'mypassword']); + // a Doctrine Connection or DSN + $databaseConnectionOrDSN = 'postgresql+advisory://myuser:mypassword@127.0.0.1:5634/lock'; + $store = new DoctrineDbalPostgreSqlStore($databaseConnectionOrDSN); In opposite to the ``DoctrineDbalStore``, the ``DoctrineDbalPostgreSqlStore`` does not need a table to store locks and does not expire.