title: Show mysql blob pdf file in Symfony 2.0
body: <p>I have a link:</p>
  
  <pre><code>    {% for item in list %}
          ...
          &lt;a href="{{ path('show', { 'id': item.id }) }}"&gt; read pdf file&lt;/a&gt;
      {% endfor %}
  </code></pre>
  
  <p>When the user clicks the link I would like to show the pdf file (file stored as a blob in mysql). The code below is not correct, but I want my action to do something like following.</p>
  
  <pre><code>    /**
      * @Route("/show", name="show")
      */
      public function showAction()
      {
          $id = $this-&gt;get('request')-&gt;query-&gt;get('id');
          $item = $this-&gt;getDoctrine()-&gt;getRepository('MyDocsBundle:Files')-&gt;file($id);
          $pdfFile = $item-&gt;getFile(); //returns pdf file stored as mysql blob
          $response = new Response();
          $response-&gt;setStatusCode(200);
          $response-&gt;headers-&gt;set('Content-Type', 'application/pdf');
          $response-&gt;setContent($pdfFile);
          $response-&gt;send() //not sure if this is needed
          return $response;
      }
  </code></pre>