We can easily embed a controller within a template in twig:
{% render "AcmeGolferBundle:Golfer:showGolfersList" %}
When we basically use a controller like this:
/**
* Lists all golfers.
*
* @Route("/golfersList", name="golfers_list")
* @Template()
*/
public function showGolfersListAction()
{
//....doStuff
}
In that case, the only use of the controller will be in that template. Is there a way to avoid the user to trigger the url directly, meaning /golferList on its own?
EDIT
The point I am trying to make is the following:
I need the user to use the controller through the template it is embedded in, but not directly via the url. I realise this might not be possible, but because the controller is embedded, it doesn’t have a proper css structure. Therefore, if it is triggered via the url directly, it will look pretty ugly on the page.
Securing route by IP might be useful for you: