我有一个“文章”实体,我想创建一个没有任何层次结构的“相关”文章的关联。只是为了能够存储一篇文章与多个其他文章相关的事实。
我经历了this reference,但多对多的自我反思没有使用YAML的例子。
设计它的正确方法是什么?
这是我目前的实体:
ContentBundle\Entity\Article:
type: entity
table: articles
repositoryClass: ContentBundle\Repository\ArticleRepository
id:
id:
type: integer
id: true
generator:
strategy: AUTO
fields:
title:
type: string
length: 255
content:
type: text
creationDate:
type: datetime
column: creation_date
updateDate:
type: datetime
column: update_date
state:
type: string
length: 255
options:
default: 'public'
oneToOne:
cover:
targetEntity: AppBundle\Entity\Image
joinColumn:
name: image_id
referencedColumnName: id
oneToMany:
notes:
targetEntity: AppBundle\Entity\Note
mappedBy: article
histories:
targetEntity: HistoricalEntry
mappedBy: article
comments:
targetEntity: AppBundle\Entity\Comment
mappedBy: article
secrets:
targetEntity: Secret
mappedBy: article
manyToOne:
author:
targetEntity: AppBundle\Entity\User
inversedBy: articles
joinColumn:
name: user_id
referencedColumnName: id
world:
targetEntity: WorldBundle\Entity\World
inversedBy: articles
joinColumn:
name: world_id
referencedColumnName: id
category:
targetEntity: WorldBundle\Entity\Category
inversedBy: articles
joinColumn:
name: category_id
referencedColumnName: id
manyToMany:
tags:
targetEntity: AppBundle\Entity\Tag
inversedBy: articles
joinTable:
name: articles_tags
joinColumns:
article_id:
referencedColumnName: id
inverseJoinColumns:
tag_id:
referencedColumnName: id
inheritanceType: JOINED
discriminatorColumn:
name: template
type: string
length: 50
discriminatorMap:
article: Article
person: Person
location: Location
organization: Organization
species: Species
options:
charset: utf8
type: InnoDB
lifecycleCallbacks: { }