Following my last question I can't manage to call the service from the template. I did exactly like in the answer, but I get 'Variable "newmessages" does not exist' in the template.
I also tried returning the service in the parent template, but the parent is never called since there is no request to it, the requests are done only to child templates.
public function indexAction(){
$locationService = $this->container->get('newmessages');
return $this->render(
'MedAppCrudBundle:UserBackend\Message:index.html.twig',
array('newmessages'=>$locationService->methodToCalculate())
);
}
How to call service from parent template? The answer from last question doesn't work.