File tree Expand file tree Collapse file tree 1 file changed +61
-0
lines changed
Expand file tree Collapse file tree 1 file changed +61
-0
lines changed Original file line number Diff line number Diff line change @@ -1954,6 +1954,67 @@ may want to use:
19541954 ],
19551955 ]);
19561956
1957+ Other Middlewares
1958+ ~~~~~~~~~~~~~~~~~
1959+
1960+ .. versionadded :: 5.3
1961+
1962+ The ``router_context `` middleware were introduced in Symfony 5.3.
1963+
1964+ When the consumer needs to build an absolute URL, for instance: rendering a
1965+ template with links, it needs the initial's request context in order to
1966+ retrieves the domain and information needed to build the URL. This can be
1967+ achieved by declaring the ``router_context `` middleware in the bus.
1968+
1969+ .. configuration-block ::
1970+
1971+ .. code-block :: yaml
1972+
1973+ # config/packages/messenger.yaml
1974+ framework :
1975+ messenger :
1976+ buses :
1977+ command_bus :
1978+ middleware :
1979+ - router_context
1980+
1981+ .. code-block :: xml
1982+
1983+ <!-- config/packages/messenger.xml -->
1984+ <?xml version =" 1.0" encoding =" UTF-8" ?>
1985+ <container xmlns =" http://symfony.com/schema/dic/services"
1986+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
1987+ xmlns : framework =" http://symfony.com/schema/dic/symfony"
1988+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
1989+ https://symfony.com/schema/dic/services/services-1.0.xsd
1990+ http://symfony.com/schema/dic/symfony
1991+ https://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
1992+
1993+ <framework : config >
1994+ <framework : messenger >
1995+ <framework : bus name =" command_bus" >
1996+ <framework : middleware id =" router_context" />
1997+ </framework : bus >
1998+ </framework : messenger >
1999+ </framework : config >
2000+ </container >
2001+
2002+ .. code-block :: php
2003+
2004+ // config/packages/messenger.php
2005+ $container->loadFromExtension('framework', [
2006+ 'messenger' => [
2007+ 'buses' => [
2008+ 'command_bus' => [
2009+ 'middleware' => [
2010+ 'router_context',
2011+ ],
2012+ ],
2013+ ],
2014+ ],
2015+ ]);
2016+
2017+
19572018 Messenger Events
19582019~~~~~~~~~~~~~~~~
19592020
You can’t perform that action at this time.
0 commit comments