mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
DDC-1121: Doctrine CLI tool produces wrong schema when the id columns of the entities are not named as $id. The annotations block aren't taken into account #1404
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 (Apr 20, 2011).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user screwyprof:
In the following examples the id fields are set to $userId (mapped to user_id) and $groupId (mapped to group_id), but when it comes to generating the schema an error occures. The Doctrine CLI Tool doesn't work properly. When it generates the schema it fails to take into account the annotation blocks and just uses "id" instead of "group_id".
Let me explain it better. If we run the tool it will produce the following code
...
instead of
Moreover using "group" as a name of the entity class will lead to numerous problems, because it's a reserved word in SQL. Even if we specify the quoatation forcibly using backticks it won't work:
The quoatation won't be taken into account while generation the schema.
I'm enclosing the files I've tried to play with. Just try to generate the schema.
@doctrinebot commented on GitHub (Apr 30, 2011):
Comment created by @beberlei:
Fixed formatting, scheduled for 2.0.5
@doctrinebot commented on GitHub (May 1, 2011):
Comment created by @beberlei:
Just understood this. This is expected behavior, "id" is the default value. Doctrine cannot - for optimization reasons - check the id column names on the other entity. That is what the @JoinColumn annotation is for, where you can explicitly give a name.
@doctrinebot commented on GitHub (May 1, 2011):
Issue was closed with resolution "Invalid"