diff --git a/lock.rst b/lock.rst index 82ec48db572..1f149466216 100644 --- a/lock.rst +++ b/lock.rst @@ -62,6 +62,8 @@ this behavior by using the ``lock`` key like: lock: 'oci:host=127.0.0.1;dbname=app' lock: 'mongodb://127.0.0.1/app?collection=lock' lock: '%env(LOCK_DSN)%' + # using an existing service + lock: 'snc_redis.default' # named locks lock: @@ -119,6 +121,9 @@ this behavior by using the ``lock`` key like: %env(LOCK_DSN)% + + snc_redis.default + semaphore redis://r2.docker @@ -130,6 +135,7 @@ this behavior by using the ``lock`` key like: .. code-block:: php // config/packages/lock.php + use function Symfony\Component\DependencyInjection\Loader\Configurator\env; use Symfony\Config\FrameworkConfig; return static function (FrameworkConfig $framework): void { @@ -152,6 +158,8 @@ this behavior by using the ``lock`` key like: ->resource('default', ['oci:host=127.0.0.1;dbname=app']) ->resource('default', ['mongodb://127.0.0.1/app?collection=lock']) ->resource('default', [env('LOCK_DSN')]) + // using an existing service + ->resource('default', ['snc_redis.default']) // named locks ->resource('invoice', ['semaphore', 'redis://r2.docker']) diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index 0334b918c66..f6a275067dc 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -2048,7 +2048,7 @@ resources **type**: ``array`` A map of lock stores to be created by the framework extension, with -the name as key and DSN as value: +the name as key and DSN or service id as value: .. configuration-block:: @@ -2725,7 +2725,7 @@ resources **type**: ``array`` A map of semaphore stores to be created by the framework extension, with -the name as key and DSN as value: +the name as key and DSN or service id as value: .. configuration-block:: @@ -2756,11 +2756,12 @@ the name as key and DSN as value: .. code-block:: php // config/packages/semaphore.php + use function Symfony\Component\DependencyInjection\Loader\Configurator\env; use Symfony\Config\FrameworkConfig; return static function (FrameworkConfig $framework): void { $framework->semaphore() - ->resource('default', ['%env(SEMAPHORE_DSN)%']); + ->resource('default', [env('SEMAPHORE_DSN')]); }; .. _reference-semaphore-resources-name: