{"action":"created","issue":{"url":"https://api.github.com/repos/propelorm/Propel2/issues/892","labels_url":"https://api.github.com/repos/propelorm/Propel2/issues/892/labels{/name}","comments_url":"https://api.github.com/repos/propelorm/Propel2/issues/892/comments","events_url":"https://api.github.com/repos/propelorm/Propel2/issues/892/events","html_url":"https://github.com/propelorm/Propel2/issues/892","id":59939403,"number":892,"title":"Joins with multiple foreign keys to same table fail","user":{"login":"jengeb","id":3831683,"avatar_url":"https://avatars.githubusercontent.com/u/3831683?v=3","gravatar_id":"","url":"https://api.github.com/users/jengeb","html_url":"https://github.com/jengeb","followers_url":"https://api.github.com/users/jengeb/followers","following_url":"https://api.github.com/users/jengeb/following{/other_user}","gists_url":"https://api.github.com/users/jengeb/gists{/gist_id}","starred_url":"https://api.github.com/users/jengeb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jengeb/subscriptions","organizations_url":"https://api.github.com/users/jengeb/orgs","repos_url":"https://api.github.com/users/jengeb/repos","events_url":"https://api.github.com/users/jengeb/events{/privacy}","received_events_url":"https://api.github.com/users/jengeb/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2015-03-05T11:30:36Z","updated_at":"2015-10-15T13:50:21Z","closed_at":null,"body":"I have problems with two foreign keys referencing the same table `users`. In a table `movies` I store both the user who created an entry (`CreateUser`) and the user who updated this entry (`UpdateUser`), see the [sandbox](http://sandbox.propelorm.org/e5a686f).\r\n\r\nI use `join()` to join the tables `movies` and `users`. Either the query to get `CreateUser` or `UpdateUser` is working. However, joining both fails. The executed SQL query seems to be\r\n\r\n```\r\nSELECT movies.ID, movies.TITLE,\r\n  users.NAME AS CreateUserName,\r\n  users.NAME AS UpdateUserName\r\n  FROM `movies`\r\n  INNER JOIN `users` ON (movies.CREATE_USER_ID=users.ID)\r\n  INNER JOIN `users` ON (movies.UPDATE_USER_ID=users.ID)\r\n```\r\n\r\nNote that `users` appears twice. Probably it should read\r\n```\r\nSELECT movies.ID, movies.TITLE,\r\n  CreateUser.NAME AS CreateUserName,\r\n  UpdateUser.NAME AS UpdateUserName\r\n  FROM `movies`\r\n  INNER JOIN `users` AS CreateUser ON (movies.CREATE_USER_ID=CreateUser.ID)\r\n  INNER JOIN `users` AS UpdateUser ON (movies.UPDATE_USER_ID=UpdateUser.ID)\r\n```\r\n\r\nIs there something wrong in my sandbox code or is there a bug in Propel2?"},"comment":{"url":"https://api.github.com/repos/propelorm/Propel2/issues/comments/148392666","html_url":"https://github.com/propelorm/Propel2/issues/892#issuecomment-148392666","issue_url":"https://api.github.com/repos/propelorm/Propel2/issues/892","id":148392666,"user":{"login":"pawel-oronowicz","id":9977991,"avatar_url":"https://avatars.githubusercontent.com/u/9977991?v=3","gravatar_id":"","url":"https://api.github.com/users/pawel-oronowicz","html_url":"https://github.com/pawel-oronowicz","followers_url":"https://api.github.com/users/pawel-oronowicz/followers","following_url":"https://api.github.com/users/pawel-oronowicz/following{/other_user}","gists_url":"https://api.github.com/users/pawel-oronowicz/gists{/gist_id}","starred_url":"https://api.github.com/users/pawel-oronowicz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pawel-oronowicz/subscriptions","organizations_url":"https://api.github.com/users/pawel-oronowicz/orgs","repos_url":"https://api.github.com/users/pawel-oronowicz/repos","events_url":"https://api.github.com/users/pawel-oronowicz/events{/privacy}","received_events_url":"https://api.github.com/users/pawel-oronowicz/received_events","type":"User","site_admin":false},"created_at":"2015-10-15T13:50:21Z","updated_at":"2015-10-15T13:50:21Z","body":"@sjbartley created PR #1009 "}}