Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [Doctrine] problem z LEFT JOIN
Daniel_K
post
Post #1





Grupa: Zarejestrowani
Postów: 18
Pomógł: 0
Dołączył: 25.11.2010

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


Witam, zaczynam przygodę z Doctrine i mam problem z Joinami. Mam taki fragment bazy:

(IMG:http://danielkrasowski.pl/work/bazaf.png)

w modelu wyciągam dane za pomocą:

  1. public static function getUnselectedService($status)
  2. {
  3. return Doctrine_Core::getTable('Service')
  4. ->createQuery('a')
  5. ->where('a.add_date < NOW()')
  6. ->leftJoin('a.ServiceStatusToService b ON a.id_status = b.id_status')
  7. ->andWhere('b.name = ?', $status)
  8. ->leftJoin('a.UserToService c ON a.id_user = c.id_user')
  9. ->leftJoin('c.UserToRank d ON c.id_user = d.id_user') // <- TEN JOIN POWODUJE BŁĄD
  10. ->execute();
  11. }


Schamat wyglada tak:

  1. User:
  2. columns:
  3. Id_user:
  4. type: integer
  5. notnull: true
  6. primary: true
  7. autoincrement: true
  8. relations:
  9. Status:
  10. foreignAlias: User1
  11. local: Id_status
  12. foreign: Id_status
  13. Services1:
  14. type: meny
  15. class: Service
  16. local: Id_user
  17. foreign: Id_user
  18. foreignAlias: UserToService
  19. Rank1:
  20. type: meny
  21. class: Rank
  22. local: Id_user
  23. foreign: Id_user
  24. foreignAlias: UserToRank
  25.  
  26. Rank:
  27. columns:
  28. Id_user:
  29. type: integer
  30. notnull: true
  31. relations:
  32.  
  33. Service:
  34. columns:
  35. Id_service:
  36. type: integer
  37. notnull: true
  38. primary: true
  39. autoincrement: true
  40. Id_category:
  41. type: integer
  42. notnull: true
  43. Id_status:
  44. type: integer
  45. notnull: true
  46. Id_user:
  47. type: integer
  48. notnull: true
  49. relations:
  50.  
  51. Service_status:
  52. columns:
  53. Id_status:
  54. type: integer
  55. notnull: true
  56. primary: true
  57. autoincrement: true
  58. Name:
  59. type: string(20)
  60. relations:
  61. Services:
  62. type: meny
  63. class: Service
  64. local: Id_status
  65. foreign: Id_status
  66. foreignAlias: ServiceStatusToService


Problem jest taki ze ostatni JOIN wywala mi błąd, nie wiem co jest nie tak. Czy mogę liczyć na jakąś pomoc? Korzystam z symfony 1.4

Pozdrawiam

Ten post edytował Daniel_K 6.12.2010, 00:50:23
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: 24.08.2025 - 02:16