mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
[PR #280] 2.1.x #7963
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Original Pull Request: https://github.com/doctrine/orm/pull/280
State: closed
Merged: Yes
Make Reverse Engineering to support Primary Keys as Foreign Keys.
The origin of the problem:
While parsing database Doctrine2 creates 2 separate arrays - "field mappings" and "association mappings".
If the field is within table foreign keys, it goes to "association mappings", otherwise it goes to "field mappings".
With primary keys as foreign keys Doctrine2 behaves incorrectly - it adds it both to "field mappings" and "association mappings", creating a nasty MappingException::duplicateFieldMapping
Reworked the code so it adds it only to the "association mappings", creating a OneToOne mapping type.
I wonder why so few attention is payed to reverse engineering in the project.
When you introspect database it only creates unidirectional mappings, so you have to manually create an
inverse in other entities.
In Doctrine 1.x it was much-much better.
Reverse engineering is not evil. Is a thing really very important in many situations when you a have a huge existing database structure.