title: Symfony Voter in twig
body: <p>I have implemented a voter system to check if a user can view the posts that he has not subscribed to. I am calling this in an action in a controller.</p>
  
  <pre><code>$this-&gt;denyAccessUnlessGranted('view', $post, 'You do not have permission to 
  view this post!');    
  </code></pre>
  
  <p>If the voter returns true, it is redirected to a twig template.</p>
  
  <p>How can I render the same template if it returns false with the message "You do not have permission to view this post!" ?</p>
  
  <p>Edited to be more clear: I do not want a user to see the posts that he has not subscribed to by changing the post id in url. So, I have implemented voters to check that. If voter returns true, twig template is rendered else the message is displayed without the template. I want this message to be displayed in the template.</p>
  
  <p>I want to use something like this in my twig template:</p>
  
  <pre><code>{% if is_granted('view', post) %}
      post
  {% else %}
      Permission denied
  {% endif %}
  </code></pre>