mirror of
https://github.com/doctrine/orm.git
synced 2026-04-29 17:33:15 +02:00
DDC-1440: Doctrine2 is not able to manage correctly a FK based on a unique string which is not a PK on its table #1809
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?
Originally created by @doctrinebot on GitHub (Oct 20, 2011).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user sibok:
Doctrine2 is not able to manage correctly a FK based on a unique string which is not a PK on its table. Tables are created successfully but data is not managed properly. I'm attaching some Entities and Fixture files in order to test it :)
@doctrinebot commented on GitHub (Oct 20, 2011):
Comment created by @beberlei:
Could you run "doctrine.php orm:validate-schema" ? I think this will give you an error that this is not possible. Doctrine can only work with foreign keys through primary keys. A workaround for this is making doctrine belive that the unique field is the identifier and that the real id field is just a regular field.
@doctrinebot commented on GitHub (Oct 20, 2011):
Comment created by sibok:
Hi, i'm using doctrine2 through symfony2 and it does not provide the command to validate the schema. I think it was removed some time ago. Could you explain a liitle bit how to accomplish your workaround? Right now i've done sme workarounds to avoid that issue but i think it's a feature which is used very often.
Thanks a lot :)
PD: Entities and fixtures are working fine.
@doctrinebot commented on GitHub (Oct 27, 2011):
Comment created by @beberlei:
You can re-add the command by just adding a plain command into your own bundle that extends from doctrines validate schema and extend the "execute" method to inject the EntityManager from the DIC correctly.
@doctrinebot commented on GitHub (Oct 31, 2011):
Comment created by @beberlei:
This is an invalid mapping.
You can only map join-columns of associations to primary keys.
@doctrinebot commented on GitHub (Oct 31, 2011):
Issue was closed with resolution "Invalid"
@doctrinebot commented on GitHub (Dec 13, 2015):
Imported 4 attachments from Jira into https://gist.github.com/97f4f992872365aa4e27