title: implementing "update if exists" in Doctrine ORM
body: <p>I am trying to <code>INSERT OR UPDATE IF EXISTS</code> in one transaction. </p>
  
  <p>in <strong>mysql</strong>, I would generally use <code>DUPLICATE KEY</code> ("UPDATE ON DUPLICATE KEY".)  I'm aware of many solutions to this problem using various SQL variants and sub-queries, but I'm trying to implement this in Doctrine (PHP ORM).  It seems there would be Doctrine methods for doing this since it's so feature packed, but I'm not finding anything.  Is this sort of thing a problem using PHP ORM packages for some reason?  Or do any Doctrine experts know how to achieve this through hacks or any means?  </p>