Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Problem z JOIN LEFT: Doctrine_Table_Exception: Unknown relation alias
tejek
post
Post #1





Grupa: Zarejestrowani
Postów: 41
Pomógł: 0
Dołączył: 12.11.2005

Ostrzeżenie: (0%)
-----


Witam,

Od pewnego czasu męczę się z MySql, Doctrine i JOINLEFT. Mój plik schema.yml wygląda tak: (w zasadzie jest to kawałek tego pliku. Plik generuje przy pomocy WorkBench-a)

  1. ---
  2. detect_relations: true
  3. options:
  4. collate: utf8_polish_ci
  5. charset: utf8
  6. type: InnoDB
  7.  
  8. User:
  9. tableName: Users
  10. COLUMNS:
  11. id:
  12. type: integer(4)
  13. PRIMARY: true
  14. notnull: true
  15. autoincrement: true
  16. username:
  17. type: string(45)
  18. notnull: true
  19. password:
  20. type: string(45)
  21. notnull: true
  22. email:
  23. type: string(45)
  24. notnull: true
  25. phone:
  26. type: string(100)
  27. notnull: true
  28. type:
  29. type: enum
  30. VALUES: ['u','a']
  31. DEFAULT: 'u'
  32. active:
  33. type: integer(1)
  34. DEFAULT: 0
  35. blocked:
  36. type: integer(1)
  37. DEFAULT: 0
  38. options:
  39. charset: utf8
  40. collate: utf8_polish_ci
  41.  
  42. UsersDetail:
  43. tableName: UsersDetails
  44. COLUMNS:
  45. user_detail_id:
  46. type: integer(4)
  47. PRIMARY: true
  48. notnull: true
  49. autoincrement: true
  50. Users_id:
  51. type: integer(4)
  52. notnull: true
  53. name:
  54. type: string(45)
  55. surname:
  56. type: string(45)
  57. address:
  58. type: string(255)
  59. city:
  60. type: string(45)
  61. postcode:
  62. type: string(45)
  63. birthdate:
  64. type: string(45)
  65. relations:
  66. User:
  67. class: User
  68. LOCAL: Users_id
  69. FOREIGN: id
  70. foreignAlias: UsersDetails
  71. options:
  72. charset: utf8
  73. collate: utf8_polish_ci


Natomiast moje zapytanie do bazy wygląda następująco:
  1. $data = Doctrine_Query::create()->from('Model_User u')->select('u.*,d.*')
  2. ->leftJoin('u.Model_UsersDetail d ON d.Users_id=u.id')
  3. ->fetchArray();


Co robię źle, że wyrzuca mi taki błąd: Doctrine_Table_Exception: Unknown relation alias Model_UsersDetail??
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 25.08.2025 - 06:25