title: Entity created whereas not asked in the code
body: <p>I don't know why, the piece of code below is creating a new <code>Colle Entity ($colle)</code> after flush. I don't understand why. This is only a part of the code but I tried to <code>flush</code> right before it and if I do that, I still have the right <code>Colle entity</code>, the one given at first.
  When I remove <code>flush</code>, The new entity is not created either. The new Colle entity is like a copy of the initial entity, with the same properties.</p>
  
  <p>This code is in a loop and the new <code>Colle entity</code> is created only the first time.</p>
  
  <pre><code>private function gestionErreur($copies,$colle) {
  
     for($positionCopie=1;$positionCopie&lt;sizeof( $copies )-1;$positionCopie++)
     {
        $user=$this-&gt;em-&gt;getRepository(Tutore::class)-&gt;findOneBy(['username'=&gt;$copies[$positionCopie]['username']]);
        $passercolle = new PasserColle($colle, $user);
        $passercolle-&gt;setClassement(-1);
        $this-&gt;em-&gt;persist($passercolle);
        $this-&gt;em-&gt;flush();
     }
  }
  </code></pre>