This example shows a User and a Phonenumber entity, where the Phonenumber entity has a phone column and a userId column (which maps the Phonenumber to the User). Primary key should be composite (phone, userId).
Normally I would achieve this by adding @Id to the User association in Phonenumber.php, but since @Id is not supported for associations, I added a userId property (which I have to set every time I set the User property).
After the SchemaTool refactoring, Doctrine 2 complains about duplicate keys when trying to create the database...
DDC-117 (@Id on associations should really be supported and add the "JoinColumn name" to the list of primary keys...)