title: Symfony2 error after trying to persist entity: Unable to find Entity
body: <p>I have two entities, Series and Magazines, with a ManyToMany relationship.
  When I try to add a new Serie, I use two routes (new and create), with the following code in the SerieController:</p>
  
  <pre><code>public function newAction($id = null)
      {
          $entity = new Serie();
          if ($id) {
              $em = $this-&gt;getDoctrine()-&gt;getManager();
              $mag = $em-&gt;getRepository('MangaBundle:Magazine')-&gt;find($id);
              $entity-&gt;addMagazine($mag);
              }
          $form   = $this-&gt;createForm(new SerieType(), $entity);
  
          return array(
              'serie' =&gt; $entity,
              'form'   =&gt; $form-&gt;createView(),
          );
      }
  </code></pre>
  
  <p>And:</p>
  
  <pre><code>public function createAction(Request $request)
      {
          $entity  = new Serie();
          $form = $this-&gt;createForm(new SerieType(), $entity);
          $form-&gt;bind($request);
  
          if ($form-&gt;isValid()) {
              $em = $this-&gt;getDoctrine()-&gt;getManager();
              $em-&gt;persist($entity);
              $magazines = $entity-&gt;getMagazines();
              foreach($magazines as $magazine){
                  $em-&gt;persist($magazine);
              }
              $em-&gt;flush();
  
              return $this-&gt;redirect($this-&gt;generateUrl('serie_show', array('id' =&gt; $entity-&gt;getId())));
          }
  
          return array(
              'serie' =&gt; $entity,
              'form'   =&gt; $form-&gt;createView(),
          );
  </code></pre>
  
  <p>But then, when I try to do it, I get this:</p>
  
  <blockquote>
  <pre><code>Unable to find Serie entity.
  
  404 Not Found - NotFoundHttpException
  </code></pre>
  </blockquote>
  
  <p>With the following error:    </p>
  
  <blockquote>
    <p>INFO - Matched route "serie_show" (parameters: "_controller":
    "MyList\DB\MangaBundle\Controller\SerieController::showAction", "id":
    "create", "_route": "serie_show")</p>
  </blockquote>
  
  <p>Which shouldn't be happening, having this in the showAction:</p>
  
  <pre><code>public function showAction($id)
      {
          $em = $this-&gt;getDoctrine()-&gt;getManager();
  
          $entity = $em-&gt;getRepository('MangaBundle:Serie')-&gt;find($id);
  
          if (!$entity) {
              throw $this-&gt;createNotFoundException('Unable to find Serie entity.');
          }
  
  
          $deleteForm = $this-&gt;createDeleteForm($id);
  
          return array(
              'serie'      =&gt; $entity,
              'delete_form' =&gt; $deleteForm-&gt;createView(),
          );
      }
  </code></pre>
  
  <p>I cna't figure out what is happening to send 'create' as id in the redirect in the createAction. Can anyone help me figure out what I'm missing?</p>