doctrine:mapping:import ignores tables #5107

Open
opened 2026-01-22 14:58:26 +01:00 by admin · 0 comments
Owner

Originally created by @Chev12 on GitHub (Apr 19, 2016).

Considering this schema:

Table A

  • idA

Table B

  • idB

Table C

  • idA
  • idB
  • label

Where C has (idA, idB) as a PK, and has 2 FK, one referencing A, the other one referencing B.
When using doctrine:mapping:import, the tool just ignores C and makes a ManyToMany relationship between A and B, even if C has additional columns.
I digged the code and found the source of the problem and tried for a fix : https://github.com/doctrine/doctrine2/pull/5790
It was doing well locally for me but for reasons unknown the tests are failing.

Note that, with this fix, trying to generate some similar tables, instead of being treated as ManyToMany join tables, made the tool throw this error:
It is not possible to map entity 'ExempleBundle\Entity\Entite1' with a composite primary key as part of the primary key of another entity 'ExempleBundle\Entity\Entite2#entite1'.

Which is more relevant for the user than the obscure ManyToMany generation.

Originally created by @Chev12 on GitHub (Apr 19, 2016). Considering this schema: Table A - idA Table B - idB Table C - idA - idB - label Where C has (idA, idB) as a PK, and has 2 FK, one referencing A, the other one referencing B. When using doctrine:mapping:import, the tool just ignores C and makes a ManyToMany relationship between A and B, even if C has additional columns. I digged the code and found the source of the problem and tried for a fix : https://github.com/doctrine/doctrine2/pull/5790 It was doing well locally for me but for reasons unknown the tests are failing. Note that, with this fix, trying to generate some similar tables, instead of being treated as ManyToMany join tables, made the tool throw this error: It is not possible to map entity 'ExempleBundle\Entity\Entite1' with a composite primary key as part of the primary key of another entity 'ExempleBundle\Entity\Entite2#entite1'. Which is more relevant for the user than the obscure ManyToMany generation.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#5107