title: Symfony 2 + Doctrine: How to supress SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry
body: <p>I've looked into a couple of posts, but couldn't find a working solution.</p>
  
  <p>My question is beyond simple:</p>
  
  <p>I have an entity with say <code>id</code>, <code>url</code> and <code>title</code>. The URL should be unique (in MySQL PDO). I've managed to create both the entity and schema with no problems. Now when I walk some records I call <code>persist()</code> on each, and finaly a <code>flush()</code>. The problem is that when I try to insert duplicate entries for the URL it gives me an exception. How to supress it?</p>
  
  <p>When a duplicate entry is being inserted it should just skip it and insert the rest. No need for events, ON UPDATE statements, triggers and all that fancy stuff.</p>
  
  <p>I've tried catching any exceptions thrown by <code>persist</code> or <code>flush()</code>, but can't really seem to do it correctly.</p>
  
  <p>Any ideas are welcome, thank you!</p>
  
  <p>EDIT: Found my solution in here: <a href="https://stackoverflow.com/questions/5689415/symfony2-controller-wont-catch-exception">Symfony2 Controller won&#39;t catch exception</a></p>