Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [Symfony]Podwójna relacja w schemacie
Marcstee
post
Post #1





Grupa: Nieautoryzowani
Postów: 42
Pomógł: 0
Dołączył: 15.12.2009

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


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.
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 1)
Quadina
post
Post #2





Grupa: Zarejestrowani
Postów: 200
Pomógł: 38
Dołączył: 1.12.2010
Skąd: Wrocław

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


  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 ;-)


--------------------
Warsztat: NetBeans 7.2 Beta, PHP, MySQL, PostgreSQL, Symfony (<=1.4), Diem, Java, Sieci neuronowe
Go to the top of the page
+Quote Post

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

 



RSS Aktualny czas: 22.08.2025 - 11:16