Benjamin Eberlei
added a comment - 28/Jun/10 4:52 AM just for understanding this scenario:
Is this a One-To-One relation and the TABLE_TEST2 "inherits" the primary key from its parent TABLE_TEST1?
If yes, this construct is not yet supported by Doctrine 2, we still need to include an ID-Generator that supports this kind of schema.

Mickael Perraud
added a comment - 28/Jun/10 5:42 AM Change for a more understandable use case. Note that it's not my real use case and that I work on legacy database on which I can't change the structure.

The relevant code is in Doctrine/ORM/Mapping/Driver/DatabaseDriver.php only.

The idea is currently many-to-many tables are detected by checking that the table has foreign keys on all the primary key columns (no additional columns!)

Now with the 2.1 feature of foreign key/primary key entities this is not necessarily true anymore. You can have the primary keys being foreign keys BUT have additional columns that are not part of the primary key. This has to be detected.

If a foreign key-primary-key entity is found that has additional columns a ClassMetadata has to be created and the associations have to be created with the "id" => true flag in mapManyToOne().

Benjamin Eberlei
added a comment - 28/Nov/11 12:11 PM More details on the work to be done:
The relevant code is in Doctrine/ORM/Mapping/Driver/DatabaseDriver.php only.
The idea is currently many-to-many tables are detected by checking that the table has foreign keys on all the primary key columns (no additional columns!)
Now with the 2.1 feature of foreign key/primary key entities this is not necessarily true anymore. You can have the primary keys being foreign keys BUT have additional columns that are not part of the primary key. This has to be detected.
If a foreign key-primary-key entity is found that has additional columns a ClassMetadata has to be created and the associations have to be created with the "id" => true flag in mapManyToOne().