Byłem już na tej stronie:
Szukałem w dokumentacji Doctrine, ale znalazłem tylko przykładowe rozwiązania
The foreignType and foreignAlias options allow you to customize the opposite end of the relationship.
ForeignType and foreignAlias opcje pozwalają dostosować drugi koniec relacji... Nie do końca jasne...
a class i refClass jest w ogóle nie wyjaśnione... Class jest też nie tylko w one-to-one..., o ile wiem to tylko refClass jest w many-to-many
Tak po za tym gdzie w pliku podajemy, do której tabeli to się tyczy... Gdy mamy contact_id i tabele contact to doctrine sam się domyśli, natomiast gdy jest inaczej to jak podać i gdzie
Normally it would have automatically generated User has one Contact and Contact has many User. The foreignType and foreignAlias options allow you to customize the opposite end of the relationship
foreignAlias pozwala nam zamienić z contact na usermodel... Tej tabeli w ogóle nie ma.. Więc co dla tej tabeli znaczy UserModel?
One to Many
---
User:
columns:
id:
type: integer(4)
primary: true
autoincrement: true
contact_id:
type: integer(4)
username:
type: string(255)
password:
type: string(255)
Phonenumber:
columns:
id:
type: integer(4)
primary: true
autoincrement: true
name:
type: string(255)
user_id:
type: integer(4)
relations:
User:
foreignAlias: Phonenumbers
Many to Many
---
User:
columns:
id:
type: integer(4)
autoincrement: true
primary: true
username:
type: string(255)
password:
type: string(255)
attributes:
export: all
validate: true
Group:
tableName: group_table
columns:
id:
type: integer(4)
autoincrement: true
primary: true
name:
type: string(255)
relations:
Users:
foreignAlias: Groups
class: User
refClass: GroupUser
GroupUser:
columns:
group_id:
type: integer(4)
primary: true
user_id:
type: integer(4)
primary: true
relations:
Group:
foreignAlias: GroupUsers
User:
foreignAlias: GroupUsers
W przykładzie one-to-many jak symfony wie, że trzeba contact_id powiązać z tabelą phonenumber?