title: Doctrine composite primary key
body: <p>I know Doctrine 2.0 supports composite keys. But I am not quite able to find out what I am looking for.</p>
  
  <p>I have 3 tables => agent, client and client_group.<br>
  Agent creates client and client_group. Client_Group has a composite primary key => id, agent_id. agent_id comes from the agent table. While I want the id to be auto incremented, the agent_id comes from agent table.<br>
  I am trying to write the yaml files but I am not sure how to specify this agent_id as a primary key in client_group. client_group_id and agent_id are foreign keys in client table. Also, I did read on the Doctrine documentation that composite PK cannot have fields that auto increment.</p>
  
  <p>So I am wondring if I can really do what I am aiming to produce here.</p>
  
  <p>The yaml showing only the relations look like this:</p>
  
  <p><strong><em>agent:</em></strong></p>
  
  <pre><code>  oneToMany:
      client_group:
        targetEntity: ClientGroup
        mappedBy: agent
      client:
        targetEntity: Client
        mappedBy: agent
  </code></pre>
  
  <p><strong><em>client_group</em></strong></p>
  
  <pre><code>  manyToOne:
      agent_id:
        targetEntity: Agent
        inversedBy: client_group
        joinColumn:
          name: agent_id
          referencedColumnName: id
  
    oneToMany:
      client:
        targetEntity: Client
        mappedBy: client_group
  </code></pre>
  
  <p><strong><em>client</em></strong></p>
  
  <pre><code>  manyToOne:
      client:
        targetEntity: ClientGroup
        inversedBy: client
        joinColumn:
          name: client_group_id
          referencedColumnName: id
      agent:
        targetEntity: Agent
        inversedBy: agents
        joinColumn:
          name: agent_id
          referencedColumnName: id
  </code></pre>
  
  <p>Any help on this would be aprreciated. Thanks.</p>