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

Appearance settings

Commit a87f21b

Browse filesBrowse files
Minor rewords
1 parent 2880027 commit a87f21b
Copy full SHA for a87f21b

File tree

1 file changed

+29
-27
lines changed
Filter options

1 file changed

+29
-27
lines changed

‎messenger.rst

Copy file name to clipboardExpand all lines: messenger.rst
+29-27Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -276,37 +276,37 @@ you can disable them like this:
276276
Using Middleware Factories
277277
~~~~~~~~~~~~~~~~~~~~~~~~~~
278278

279-
Some third-parties may expose you configurable middleware by using factories.
280-
Such factories are actually relying on the Symfony DI capabilities and consist
281-
of this kind of two services:
279+
Sometimes middleware are configurable using factories. There are two types of
280+
factories and they are based on Symfony's :doc:`dependency injection </service_container>`
281+
features:
282282

283283
.. code-block:: yaml
284284
285285
services:
286286
287-
# A factory class is registered as a service with required dependencies
288-
# to instantiate a middleware:
287+
# Type 1: a factory class is registered as a service with the required
288+
# dependencies to instantiate a middleware
289289
doctrine.orm.messenger.middleware_factory.transaction:
290-
class: Symfony\Bridge\Doctrine\Messenger\DoctrineTransactionMiddlewareFactory
291-
arguments: ['@doctrine']
290+
class: Symfony\Bridge\Doctrine\Messenger\DoctrineTransactionMiddlewareFactory
291+
arguments: ['@doctrine']
292292
293-
# An abstract definition that will call the factory with default arguments
294-
# or the one provided in the middleware config:
293+
# Type 2: an abstract definition that will call the factory with default arguments
294+
# or the one provided in the middleware config
295295
messenger.middleware.doctrine_transaction_middleware:
296-
class: Symfony\Bridge\Doctrine\Messenger\DoctrineTransactionMiddleware
297-
factory: ['@doctrine.orm.messenger.middleware_factory.transaction', 'createMiddleware']
298-
abstract: true
299-
# the default arguments to use when none provided from config.
300-
# i.e:
301-
# middleware:
302-
# - doctrine_transaction_middleware: ~
303-
arguments: ['default']
296+
class: Symfony\Bridge\Doctrine\Messenger\DoctrineTransactionMiddleware
297+
factory: ['@doctrine.orm.messenger.middleware_factory.transaction', 'createMiddleware']
298+
abstract: true
299+
# the default arguments to use when none provided from config. Example:
300+
# middleware:
301+
# - doctrine_transaction_middleware: ~
302+
arguments: ['default']
304303
305-
The "default" value in this example corresponds to the entity manager name to use, as expected by the
306-
``Symfony\Bridge\Doctrine\Messenger\DoctrineTransactionMiddlewareFactory::createMiddleware`` method as argument.
304+
The "default" value in this example is the name of the entity manager to use,
305+
which is the argument expected by the
306+
``Symfony\Bridge\Doctrine\Messenger\DoctrineTransactionMiddlewareFactory::createMiddleware`` method.
307307

308-
Then you can reference and configure the ``messenger.middleware.doctrine_transaction_middleware``
309-
service as a middleware:
308+
Then you can reference and configure the
309+
``messenger.middleware.doctrine_transaction_middleware`` service as a middleware:
310310

311311
.. configuration-block::
312312

@@ -368,18 +368,20 @@ service as a middleware:
368368
369369
.. note::
370370

371-
  The shorthand ``doctrine_transaction_middleware`` name can be used by convention,
372-
as the service id is prefixed with the ``messenger.middleware.`` namespace.
371+
The ``doctrine_transaction_middleware`` shortcut is a convention. The real
372+
service id is prefixed with the ``messenger.middleware.`` namespace.
373373

374374
.. note::
375375

376-
  Middleware factories only allow scalar and array arguments in config (no service reference).
377-
For most advanced use-cases, register a concrete definition of the middleware yourself and use its id.
376+
Middleware factories only allow scalar and array arguments in config (no
377+
references to other services). For most advanced use-cases, register a
378+
concrete definition of the middleware manually and use its id.
378379

379380
.. tip::
380381

381-
  The ``doctrine_transaction_middleware`` is an existing middleware wired
382-
by the DoctrineBundle if installed and the Messenger component enabled.
382+
The ``doctrine_transaction_middleware`` is a built-in middleware wired
383+
automatically when the DoctrineBundle and the Messenger component are
384+
installed and enabled.
383385

384386
Your own Transport
385387
------------------

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.