Skip to content

Commit a499d12

Browse files
committed
minor #6298 Update dependency_injection.rst because it has an error. (joserprieto)
This PR was submitted for the 3.0 branch but it was merged into the 2.8 branch instead (closes #6298). Discussion ---------- Update dependency_injection.rst because it has an error. The line: $sc->register('listener.router', 'Symfony\Component\HttpKernel\EventListener\RouterListener') ->setArguments(array(new Reference('matcher'))) ; is wrong, because the Symfony\Component\HttpKernel\EventListener\ResponseListener has two mandatory arguments; an instance of Symfony\Component\Routing\Matcher\UrlMatcher (or RequestMatcher), and an instance of RequestStack; so, we need to add the line: $sc->register('request_stack', 'Symfony\Component\HttpFoundation\RequestStack'); And change the registration of listener.router on this form: $sc->register('listener.router', 'Symfony\Component\HttpKernel\EventListener\RouterListener') ->setArguments(array(new Reference('matcher'), new Reference('request_stack'))) ; Commits ------- 06eee41 Update dependency_injection.rst because it has an error.
2 parents 3d3bac0 + 06eee41 commit a499d12

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

create_framework/dependency_injection.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,11 @@ Create a new file to host the dependency injection container configuration::
100100
$sc->register('matcher', 'Symfony\Component\Routing\Matcher\UrlMatcher')
101101
->setArguments(array($routes, new Reference('context')))
102102
;
103+
$sc->register('request_stack', 'Symfony\Component\HttpFoundation\RequestStack');
103104
$sc->register('resolver', 'Symfony\Component\HttpKernel\Controller\ControllerResolver');
104105

105106
$sc->register('listener.router', 'Symfony\Component\HttpKernel\EventListener\RouterListener')
106-
->setArguments(array(new Reference('matcher')))
107+
->setArguments(array(new Reference('matcher'), new Reference('request_stack')))
107108
;
108109
$sc->register('listener.response', 'Symfony\Component\HttpKernel\EventListener\ResponseListener')
109110
->setArguments(array('UTF-8'))

0 commit comments

Comments
 (0)