Reputation: 589
In a URL load 2 controllers, one by the route:
home:
path: /
defaults: { _controller: AppBundle:Default:index }
another one on twig:
{{ render(controller('AppBundle:Default:twig')) }}
I created a http service, with onKernelResponse, and I would like to identify if controller is loaded by route or by twig.
Any idea to resolve it?
I found 2 diferences in headers:
doesn't appear on controller load by route.
perhaps the solution is on this way?
Upvotes: 1
Views: 39
Reputation: 589
this is the solution
public function onKernelResponse(FilterResponseEvent $event) {
if($event->isMasterRequest()){
// here my code
}
}
Upvotes: 1