mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
DDC-479: MEMBER OF generates wrong SQL #596
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 (Mar 26, 2010).
Jira issue originally created by user @beberlei:
Generates the following error: ERROR 1054 (42S22): Unknown column 'b0_.id' in 'on clause'
@doctrinebot commented on GitHub (Mar 26, 2010):
Comment created by romanb:
Correct SQL should be:
@doctrinebot commented on GitHub (Mar 26, 2010):
Comment created by romanb:
Should be fixed now.
@doctrinebot commented on GitHub (Mar 26, 2010):
Issue was closed with resolution "Fixed"
@doctrinebot commented on GitHub (Jul 30, 2010):
Comment created by jorritposthuma:
Not sure if it is the same, but MEMBER OF might still not generating correct SQL (or we are doing something wrong):
SELECT g FROM Model:User\Group g WHERE :user MEMBER OF g.users
Tables:
User_User
User_Group
Results in:
SELECT u0_.id AS id0, u0_.name AS name1, u0_.removable AS removable2 FROM User_Group u0_ WHERE EXISTS (SELECT 1 FROM u1_ INNER JOIN User_User u2_ ON u1_.user_id = u2_.id WHERE u1_.group_id = u0_.id AND u2_.id = ?)
Should be:
SELECT u0_.id AS id0, u0_.name AS name1, u0_.removable AS removable2 FROM User_Group u0_ WHERE EXISTS (SELECT 1 FROM User_UserGroups u1_ INNER JOIN User_User u2_ ON u1_.user_id = u2_.id WHERE u1_.group_id = u0_.id AND u2_.id = 1)
@doctrinebot commented on GitHub (Jul 30, 2010):
Comment created by jorritposthuma:
I guess that _validateAndCompleteMapping of AssociationMapping needs the addition of:
$this->joinTable = $mapping['joinTable']; at line 222 resulting in:
@doctrinebot commented on GitHub (Jul 30, 2010):
Comment created by romanb:
No, only the owning side has the join table. Your mapping is wrong. Remove @JoinTable from the inverse side entirely.
@doctrinebot commented on GitHub (Jul 30, 2010):
Comment created by jorritposthuma:
Thanks, just figured that out :).
@doctrinebot commented on GitHub (Jul 30, 2010):
Comment created by jorritposthuma:
Now i remember why we do have the @JoinTable on the inverse side. We want to specify a @JoinTable( name="User_UserGroups" ). It doen't work only specified on the owning side, and we figured out that this was the only way?
@doctrinebot commented on GitHub (Jul 30, 2010):
Comment created by jorritposthuma:
Never mind. Need to get some sleep. Sorry for the inconvenience. Only wanted to help. Love the Doctrine 2 project!!!
@doctrinebot commented on GitHub (Jul 30, 2010):
Comment created by jorritposthuma:
Sorry, last question, shouldn't the SqlWalker in that case call getQuotedJoinTableName on the owningAssoc, instead of assoc? ( Line 1404 rev.
0c07b31136)@doctrinebot commented on GitHub (Jul 31, 2010):
Comment created by jorritposthuma:
Should i create a new Issue for that?
@doctrinebot commented on GitHub (Aug 1, 2010):
Comment created by @beberlei:
yes please!