title: Doctrine2 / MySQL - Create an auto increment field on multiple columns
body: <p>I wanted to know if it is possible to have an auto increment field based on multiple columns ? </p>
  
  <p>Here is my problem : 
  I have a table which stores CARTS in LINES. I have a unique id for each carts but I also want to generate a unique id for each line. So I can have a unique CART ID inside a line.</p>
  
  <p>Actually, I want to exactly do the same as in this example from the MySQL doc : </p>
  
  <p><a href="http://dev.mysql.com/doc/refman/5.0/en/example-auto-increment.html" rel="nofollow noreferrer">http://dev.mysql.com/doc/refman/5.0/en/example-auto-increment.html</a></p>
  
  <pre><code>+--------+----+---------+
  | grp    | id | name    |
  +--------+----+---------+
  | fish   |  1 | lax     |
  | mammal |  1 | dog     |
  | mammal |  2 | cat     |
  | mammal |  3 | whale   |
  | bird   |  1 | penguin |
  | bird   |  2 | ostrich |
  +--------+----+---------+
  </code></pre>
  
  <p>The id increments within the grp column.</p>
  
  <p>I'm a bit lost with primary key / index and I don't know if I have to use these in order to generate my ids.</p>
  
  <p>I tried to add this to my symfony entity, but it didn't generate a new column with the id I want.</p>
  
  <pre><code> * @ORM\Table(indexes={@ORM\Index(name="line_idx", columns={"line_id"})})
  </code></pre>