の多くの関係に多くの複数の私は3つのエンティティを持っています。曲は複数のアーティストを持つこともできますし、その逆もあります。はSymfony2の
私は2つの多対多の関係を作成しようとしています。エンティティclasesを生成するときしかし、二つの第一は、常に二つによって「上書き」されており、何の変数やアクセサはその1つのために作成されていません。..
ここに私のYAMLです:(更新)
Foo\BarBundle\Entity\Song:
type: entity
table: song
id:
id:
type: integer
generator:
strategy: AUTO
fields:
title:
type: string
length: 300
mime_type:
type: string
length: 20
filesize:
type: integer
length: 20
length:
type: string
length: 20
created_at:
type: datetime
gedmo:
timestampable:
on: create
manyToOne:
user:
targetEntity: Spotaset\UserBundle\Entity\User
inversedBy: songs
manyToMany:
genres:
targetEntity: Genre
inversedBy: songs
manyToMany:
artists:
targetEntity: Artist
inversedBy: songs
Foo\BarBundle\Entity\Artist:
type: entity
table: artist
id:
id:
type: integer
generator:
strategy: AUTO
fields:
name:
type: string
length: 100
unique: true
manyToMany:
songs:
targetEntity: Song
mappedBy: artistss
Foo\BarBundle\Entity\Genre:
type: entity
table: genre
id:
id:
type: integer
generator:
strategy: AUTO
fields:
name:
type: string
length: 100
unique: true
manyToMany:
songs:
targetEntity: Song
mappedBy: genres
これはバグですか、この設計は、一般的にはちょうど悪いと天気を私は知らないので、私は、リレーショナルデータベースについて多くを知らない
..
すべてのヘルプは大歓迎です!
:私はこのような見出し多対多1の下で、多くの多くの両方を定義する必要がありましたが判明。私は明示的に結合エンティティを作成し、次に簡単なOneToMany/ManyToOne関係を使用します。 – Cerad