title: How to manually set a primary key in Doctrine2
body: <p>I am importing data into a new Symfony2 project using Doctrine2 ORM.</p>
  
  <p>All new records should have an auto-generated primary key.  However, for my import, I would like to preserve the existing primary keys.</p>
  
  <p>I am using this as my Entity configuration:</p>
  
  <pre><code>  type: entity
    id:
      id:
        type: integer
        generator: { strategy: AUTO }
  </code></pre>
  
  <p>I have also created a setter for the id field in my entity class.</p>
  
  <p>However, when I persist and flush this entity to the database, the key I manually set is not preserved.</p>
  
  <p>What is the best workaround or solution for this?</p>