title: Symfony 3.4/doctrine2 : get entity original data in a detached object for comparison purposes
body: <p>I'm working on a Symfony 3.4 project and before flushing modification for an entity, I have to compare its old data (original data which are now in the database) with new modification I make before flushing.</p>
  <p>So I want to have a detach object which contains my entity with its original data.</p>
  <h1>VenteController.php:</h1>
  <pre><code>public fucntion editAction(Request $request, Vente $vente){
          //...
          $originalVente = ????;
          if ( $vente-&gt;getMontant() &gt; $originalVente-&gt;getMontant() ){
            //trait
          }
          $em-&gt;persist($vente);
          $em-&gt;flush();
      }
  </code></pre>