例如symfony2中的例子:
Ens\JobeetBundle\Entity\CategoryAffiliate: type: entity table: category_affiliate id: id: type: integer generator: { strategy: AUTO } manyToOne: category: targetEntity: Category inversedBy: category_affiliates joinColumn: name: category_id referencedColumnName: id affiliate: targetEntity: Affiliate inversedBy: category_affiliates joinColumn: name: affiliate_id referencedColumnName: id
比較詳盡的解釋如generator這個option,以及manyToOne和OneToMany的option的文檔
doctrine官網我找到的並不太清楚