Skip to content

Commit

Permalink
minor symfony#6298 Update dependency_injection.rst because it has an …
Browse files Browse the repository at this point in the history
…error. (joserprieto)

This PR was submitted for the 3.0 branch but it was merged into the 2.8 branch instead (closes symfony#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.
  • Loading branch information
xabbuh committed Feb 27, 2016
2 parents 3d3bac0 + 06eee41 commit a499d12
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion create_framework/dependency_injection.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,11 @@ Create a new file to host the dependency injection container configuration::
$sc->register('matcher', 'Symfony\Component\Routing\Matcher\UrlMatcher')
->setArguments(array($routes, new Reference('context')))
;
$sc->register('request_stack', 'Symfony\Component\HttpFoundation\RequestStack');
$sc->register('resolver', 'Symfony\Component\HttpKernel\Controller\ControllerResolver');

$sc->register('listener.router', 'Symfony\Component\HttpKernel\EventListener\RouterListener')
->setArguments(array(new Reference('matcher')))
->setArguments(array(new Reference('matcher'), new Reference('request_stack')))
;
$sc->register('listener.response', 'Symfony\Component\HttpKernel\EventListener\ResponseListener')
->setArguments(array('UTF-8'))
Expand Down

0 comments on commit a499d12

Please sign in to comment.