I zaczynamy:podałeś te same aliasy dla relacji.
User:
relations:
viewed_by:
class: View
local: user_id
foreign: viewed_id
type: many
foreignType: one
foreignAlias: viewed
viewed:
class: View
local: user_id
foreign: viewer_id
type: many
foreignType: one
foreignAlias: viewer
Lub inaczej skonfigurujesz całą relację wiele-do-wielu:
User:
relations:
viewed_by:
class: User
local: viewed_id
foreign: viewer_id,
refClass: View
viewed:
class: User
local:viewer_id
foreign: viewed_id
refClass: View
i View
powinien wyglądać
View:
columns:
viewed_id:
type: integer
primary: true
viewer_id:
type: integer
primary: true
Zobacz dokumentację Doctrine na wiele-do-wielu relacji .