title: Continue persisting entities after the UniqueConstraintViolationException in Doctrine ORM?
body: <p>I'm trying to continue persisting entities after an UniqueConstraintViolationException</p>
  
  <p>I'm uploading a list of codes and saving into the database using Doctrine ORM entities.</p>
  
  <p>I want to avoid the duplicated codes and continue saving the others.</p>
  
  <p>The simple solution of querying first to see if the code is in the database and then save is okay but it is posible just to ignore the exception and continue? To avoid query the database.</p>
  
  <pre><code>foreach($uploadEntities as $entity){ 
   try{
     $em-&gt;persist($entity);
   }catch(UniqueConstraintViolationException){
     //ignore  
   }
  }
  </code></pre>