Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [Symfony]Podwójna relacja w schemacie
Forum PHP.pl > Forum > PHP > Frameworki
Marcstee
Hej.

[Symfony 1.4 Doctrine]

Mam taki problem. Mam 2 tabele które chce podwójnie połączyć. Schemat wygląda mniej wiecej tak:
  1. Table1:
  2. columns:
  3. table1_id: { type: integer, notnull: true, primary: true, autoincrement: true }
  4. ...
  5.  
  6. Tabel2:
  7. columns:
  8. tabel2_id: { type: integer, notnull: true, primary: true, autoincrement: true }
  9. table1_1_id: { type: integer, notnull: true}
  10. table1_2_id: { type: integer, notnull: true}
  11. relations:
  12. Table1:
  13. local: table1_1_id
  14. foreign: table1_id
  15. foreignAlias: Table11
  16. Table1:
  17. local: table1_2_id
  18. foreign: table1_id
  19. foreignAlias: Table12


jednak jedyne połączenie jakie doctrine tworzy to to pierwsze, to drugie w ogóle nie jest tworzone przez co nie da się dotrzeć do tego obiektu.

Bardzo bym prosił o pomoc.
Quadina
  1. Tabel2:
  2. columns:
  3. tabel2_id: { type: integer, notnull: true, primary: true, autoincrement: true }
  4. table1_1_id: { type: integer, notnull: true}
  5. table1_2_id: { type: integer, notnull: true}
  6. relations:
  7. Table1_1:
  8. class: Table1
  9. local: table1_1_id
  10. foreign: table1_id
  11. foreignAlias: Table11
  12. Table1_2:
  13. class: Table1
  14. local: table1_2_id
  15. foreign: table1_id
  16. foreignAlias: Table12


Pisząc w tablicy relations dwa razy Table1 zastępujesz jedna drugą. Dodałem _1 i _2 odpowiednio. wewnątrz tych tabel ustawiłem class na Table1. Jeżeli parametr class nie jest ustawiony brany jest z nazwy tablicy, zatem teraz po prost sprecyzowaliśmy wszystko ;-)
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.