title: Symfony route access check
body: <p>I have a website made with Symfony 3.4 and within my actions I must check if the current user can edit the target product, something like this:</p>
  
  <pre><code>/**
   * @Route("/products/{id}/edit")
   */
  public function editAction(Request $request, Product $product)
  {
      // security
      $user = $this-&gt;getUser();
      if ($user != $product-&gt;getUser()) {
          throw $this-&gt;createAccessDeniedException();
      }
  
      // ...
  }
  </code></pre>
  
  <p>How can I avoid making the same check on every action (bonus points if using <strong>annotations and expressions</strong>)?</p>
  
  <p>I am already using <code>security.yml</code> with access_control to deny access based on roles.</p>