我正在尝试为一张表创建两个 oneToMany 关系。但是,当我生成实体时,连接列不会在 Foo 实体上生成。这是我的yaml:
用户.orm.yml
Acme\SomeBundle\Entity\User:
type: entity
table: user
id:
id:
type: integer
generator:
strategy: AUTO
fields:
firstname:
type: string
length: 40
created_at:
type: datetime
gedmo:
timestampable:
on: create
updated_at:
type: datetime
gedmo:
timestampable:
on: update
oneToMany:
foos:
targetEntity: Foo
mappedBy: user
艺术家.orm.yml
Acme\SomeBundle\Entity\Artist:
type: entity
table: artist
id:
id:
type: integer
generator:
strategy: AUTO
fields:
name:
type: string
length: 100
oneToMany:
foos:
targetEntity: Foo
mappedBy: artist
Foo.orm.yml
Acme\SomeBundle\Entity\Foo:
type: entity
table: foo
id:
id:
type: integer
generator:
strategy: AUTO
fields:
created_at:
type: datetime
gedmo:
timestampable:
on: create
updated_at:
type: datetime
gedmo:
timestampable:
on: update
ManyToOne:
artist:
targetEntity: Artist
inversedBy: foos
user:
targetEntity: User
inversedBy: foos
Foo 表上只创建了 id、created_at 和 updated_at 列,同时还应该创建两个连接列。我也尝试在我的 yaml 文件中手动定义连接列,但是文档说这不应该是必需的。
有人有线索吗?