Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcd314b1

Browse files
committed
Merge branch '7.2' into 7.3
* 7.2: Added the missing versionadded directive [FrameworkBundle] Using existing services as lock/semaphore resources
2 parents1f9919e +9f396ee commitcd314b1

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

‎lock.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ this behavior by using the ``lock`` key like:
6262
lock:'oci:host=127.0.0.1;dbname=app'
6363
lock:'mongodb://127.0.0.1/app?collection=lock'
6464
lock:'%env(LOCK_DSN)%'
65+
# using an existing service
66+
lock:'snc_redis.default'
6567
6668
# named locks
6769
lock:
@@ -119,6 +121,9 @@ this behavior by using the ``lock`` key like:
119121
120122
<framework:resource>%env(LOCK_DSN)%</framework:resource>
121123
124+
<!-- using an existing service-->
125+
<framework:resource>snc_redis.default</framework:resource>
126+
122127
<!-- named locks-->
123128
<framework:resourcename="invoice">semaphore</framework:resource>
124129
<framework:resourcename="invoice">redis://r2.docker</framework:resource>
@@ -130,6 +135,7 @@ this behavior by using the ``lock`` key like:
130135
..code-block::php
131136
132137
// config/packages/lock.php
138+
use function Symfony\Component\DependencyInjection\Loader\Configurator\env;
133139
use Symfony\Config\FrameworkConfig;
134140
135141
return static function (FrameworkConfig $framework): void {
@@ -152,13 +158,19 @@ this behavior by using the ``lock`` key like:
152158
->resource('default', ['oci:host=127.0.0.1;dbname=app'])
153159
->resource('default', ['mongodb://127.0.0.1/app?collection=lock'])
154160
->resource('default', [env('LOCK_DSN')])
161+
// using an existing service
162+
->resource('default', ['snc_redis.default'])
155163
156164
// named locks
157165
->resource('invoice', ['semaphore', 'redis://r2.docker'])
158166
->resource('report', ['semaphore'])
159167
;
160168
};
161169
170+
..versionadded::7.2
171+
172+
The option to use an existing service as the lock/semaphore was introduced in Symfony 7.2.
173+
162174
Locking a Resource
163175
------------------
164176

‎reference/configuration/framework.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2048,7 +2048,7 @@ resources
20482048
**type**: ``array``
20492049

20502050
A map of lock stores to be created by the framework extension, with
2051-
the name as key and DSN as value:
2051+
the name as key and DSNor service idas value:
20522052

20532053
..configuration-block::
20542054

@@ -2725,7 +2725,7 @@ resources
27252725
**type**: ``array``
27262726

27272727
A map of semaphore stores to be created by the framework extension, with
2728-
the name as key and DSN as value:
2728+
the name as key and DSNor service idas value:
27292729

27302730
..configuration-block::
27312731

@@ -2756,11 +2756,12 @@ the name as key and DSN as value:
27562756
..code-block::php
27572757
27582758
// config/packages/semaphore.php
2759+
use function Symfony\Component\DependencyInjection\Loader\Configurator\env;
27592760
use Symfony\Config\FrameworkConfig;
27602761
27612762
return static function (FrameworkConfig $framework): void {
27622763
$framework->semaphore()
2763-
->resource('default', ['%env(SEMAPHORE_DSN)%']);
2764+
->resource('default', [env('SEMAPHORE_DSN')]);
27642765
};
27652766
27662767
.. _reference-semaphore-resources-name:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp