I'm relatively new to Symfony, and currently using v 2.8. I've been using the @Template annotation successfully like this:
/**
* @Route("/editleague/")
* @Template()
*/
public function editAction() {
return $array;
}
And that successfully renders the twig template at Bundle/Resources/views/Default/edit.html.twig
I decided I want a different response (not a Twig template) if it was a post request, so just to start off, I changed the above code to:
/**
* @Route("/editleague/")
*/
public function editAction() {
return $this->render("Default/edit.html.twig",$array);
}
But I get a 500 error. I've tried various combinations, but haven't gotten anything to work where I can control the rendered template in the function itself. I believe it's a simple issue that someone with more experience will be able to figure out in seconds.
$arrayis not defined (but that's probably due to a bad example in your question, right?). So please show what the log of your application is telling you about the error and/or visit it in the dev environment and tell us what is shown there.