Skip to content

Commit 269991e

Browse files
committed
minor #70 Improve the checking if the current request is a master request in the ControllerListener. (voronkovich)
This PR was merged into the master branch. Discussion ---------- Improve the checking if the current request is a master request in the ControllerListener. There is a more convenient way to check whether the current request is a master request. See http://api.symfony.com/2.7/Symfony/Component/HttpKernel/Event/KernelEvent.html#method_isMasterRequest Commits ------- a90021f Improve the checking if the current request is a master request in the ControllerListener
2 parents 6297ae3 + a90021f commit 269991e

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/AppBundle/EventListener/ControllerListener.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace AppBundle\EventListener;
1313

14-
use Symfony\Component\HttpKernel\HttpKernelInterface;
1514
use Symfony\Component\HttpKernel\Event\FilterControllerEvent;
1615
use AppBundle\Twig\SourceCodeExtension;
1716

@@ -41,7 +40,7 @@ public function registerCurrentController(FilterControllerEvent $event)
4140
// this check is needed because in Symfony a request can perform any
4241
// number of sub-requests. See
4342
// http://symfony.com/doc/current/components/http_kernel/introduction.html#sub-requests
44-
if (HttpKernelInterface::MASTER_REQUEST === $event->getRequestType()) {
43+
if ($event->isMasterRequest()) {
4544
$this->twigExtension->setController($event->getController());
4645
}
4746
}

0 commit comments

Comments
 (0)