Kod
Plane:
columns:
id:
type: integer(4)
primary: true
autoincrement: true
name:
type: varchar(64)
notnull: true
type_id:
type: integer(4)
primary: true
price_id:
type: integer(4)
primary: true
active:
type: boolean
notnull: true
default: true
Reservation:
columns:
id:
type: integer(4)
primary: true
autoincrement: true
start_date:
type: time
notnull: true
end_date:
type: time
notnull: true
plane_id:
type: integer(4)
relations:
Plane:
foreignType: one
columns:
id:
type: integer(4)
primary: true
autoincrement: true
name:
type: varchar(64)
notnull: true
type_id:
type: integer(4)
primary: true
price_id:
type: integer(4)
primary: true
active:
type: boolean
notnull: true
default: true
Reservation:
columns:
id:
type: integer(4)
primary: true
autoincrement: true
start_date:
type: time
notnull: true
end_date:
type: time
notnull: true
plane_id:
type: integer(4)
relations:
Plane:
foreignType: one
Po wywołaniu taska "symfony build:all ..." tabele w bazie tworzone są w taki sposób, że obie są połączone dwukierunkową relacją. Najprościej mówiąc Doctrine tworzy klucz obcy nie tylko w tabeli "reservation" (jak w/g mnie powinno wynikać z powyższego schematu), ale także w "plane". Relacje w pozostałych tabelach, które wcześniej miałem w tym samym YMLu tworzone były prawidłowo. Co lepsze - jeśli zakomentuję/usunę z definicji tabeli "plane" pola "type_id" i "price_id", to relacja zostanie prawidłowo utworzona.
Podsumowując: jak za pomocą tasków "symfony doctrine:build" wygenerować tabele z powyższego schematu, tak by relacja między nimi była jednokierunkowa, tworzona tylko w tabeli "reservation", bez FK w tabeli "plane"? Używam symfony 1.4.7-DEV i MySQL 5.1.41.
Liczę na Was koledzy, bo naprawdę tu utknąłem. Pozdrawiam.
PS. Aż wstyd, że dwa dni się z tym męczę, a dopiero teraz zauważyłem, co może być nie tak. Po jaką ch.....ę dałem "primary: true" w definicji "type_id" i "price_id"? Umówmy się, że to przez upały, ok? Sorki za zaśmiecanie i pozdrawiam.