Skip to content

Commit 0a4192c

Browse files
committed
[#5444] Fixing missing public: false declarations and proofing
1 parent 963ed7f commit 0a4192c

File tree

1 file changed

+21
-18
lines changed

1 file changed

+21
-18
lines changed

reference/dic_tags.rst

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -246,10 +246,13 @@ services:
246246
services:
247247
app.mysql_lock:
248248
class: AppBundle\Lock\MysqlLock
249+
public: false
249250
app.postgresql_lock:
250251
class: AppBundle\Lock\PostgresqlLock
252+
public: false
251253
app.sqlite_lock:
252254
class: AppBundle\Lock\SqliteLock
255+
public: false
253256
254257
.. code-block:: xml
255258
@@ -259,26 +262,29 @@ services:
259262
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
260263
261264
<services>
262-
<service id="app.mysql_lock" class="AppBundle\Lock\MysqlLock" />
263-
<service id="app.postgresql_lock" class="AppBundle\Lock\PostgresqlLock" />
264-
<service id="app.sqlite_lock" class="AppBundle\Lock\SqliteLock" />
265+
<service id="app.mysql_lock" public="false"
266+
class="AppBundle\Lock\MysqlLock" />
267+
<service id="app.postgresql_lock" public="false"
268+
class="AppBundle\Lock\PostgresqlLock" />
269+
<service id="app.sqlite_lock" public="false"
270+
class="AppBundle\Lock\SqliteLock" />
265271
</services>
266272
</container>
267273
268274
.. code-block:: php
269275
270276
$container
271-
->register('app.mysql_lock', 'AppBundle\Lock\MysqlLock')
272-
->register('app.postgresql_lock', 'AppBundle\Lock\PostgresqlLock')
273-
->register('app.sqlite_lock', 'AppBundle\Lock\SqliteLock')
277+
->register('app.mysql_lock', 'AppBundle\Lock\MysqlLock')->setPublic(false)
278+
->register('app.postgresql_lock', 'AppBundle\Lock\PostgresqlLock')->setPublic(false)
279+
->register('app.sqlite_lock', 'AppBundle\Lock\SqliteLock')->setPublic(false)
274280
;
275281
276282
Instead of dealing with these three services, your application needs a generic
277-
``app.lock`` service. This service must be an alias to any of the other services.
278-
Thanks to the ``auto_alias`` option, you can automatically create that alias
279-
based on the value of a configuration parameter.
283+
``app.lock`` service that will be an alias to one of these services, depending on
284+
some configuration. Thanks to the ``auto_alias`` option, you can automatically create
285+
that alias based on the value of a configuration parameter.
280286

281-
Considering that a configuration parameter called ``database_type`` exists,
287+
Considering that a configuration parameter called ``database_type`` exists. Then,
282288
the generic ``app.lock`` service can be defined as follows:
283289

284290
.. configuration-block::
@@ -287,14 +293,11 @@ the generic ``app.lock`` service can be defined as follows:
287293
288294
services:
289295
app.mysql_lock:
290-
class: AppBundle\Lock\MysqlLock
291-
public: false
296+
# ...
292297
app.postgresql_lock:
293-
class: AppBundle\Lock\PostgresqlLock
294-
public: false
298+
# ...
295299
app.sqlite_lock:
296-
class: AppBundle\Lock\SqliteLock
297-
public: false
300+
# ...
298301
app.lock:
299302
tags:
300303
- { name: auto_alias, format: "app.%database_type%_lock" }
@@ -331,8 +334,8 @@ the generic ``app.lock`` service can be defined as follows:
331334
->addTag('auto_alias', array('format' => 'app.%database_type%_lock'))
332335
;
333336
334-
The ``format`` parameter defines the expression used to construct the name of
335-
the service to alias. This expression can use any container parameter (as usual,
337+
The ``format`` option defines the expression used to construct the name of the service
338+
to alias. This expression can use any container parameter (as usual,
336339
wrapping their names with ``%`` characters).
337340

338341
.. note::

0 commit comments

Comments
 (0)