title: How to check if entity changed in Doctrine 2?
body: <p>I need to check if a persisted entity has changed and needs to be updated on the database.
  What I made (and did not work) was the following:</p>
  
  <pre><code>$product = $entityManager-&gt;getRepository('Product')-&gt;find(3);
  $product-&gt;setName('A different name');
  
  var_export($entityManager-&gt;getUnitOfWork()-&gt;isScheduledForUpdate($product));
  </code></pre>
  
  <p>That code prints always <code>false</code>, I also tried to flush before check the unit of work, but did not work.</p>
  
  <p>Anyone has a suggestion?</p>