많은 관계로 많은 여러 나는 3 개 기관이있다. 노래에는 여러 아티스트가있을 수 있으며 그 반대의 경우도 마찬가지입니다.는 symfony2
그래서 저는 2 대 다 대다 관계를 만들려고합니다. (업데이트)
: 엔터티 clases를 생성 할 때 그러나 두의 첫 번째는 여기 내 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
나는 모든 도움을 크게 감사합니다 ..
를 관계형 데이터베이스에 대해 많이 알고하지 않습니다!
난 항상 조인 테이블의 자동 생성과 MasnyToMany 관계는 내 취향에 너무 많은 마술 것으로 나타났습니다. 나는 명시 적으로 조인 엔티티를 생성 한 다음 간단한 OneToMany/ManyToOne 관계를 사용합니다. – Cerad