Php symfony2中未生成外键
我遇到了一个简单的问题。我有一个医生,城市和地区实体。 医生表是指一个城市和一个地区表 在医生表中生成外键city\u id,但未创建area\u id。请帮助我克服这种情况 关系如下: area.orm.ymlPhp symfony2中未生成外键,php,symfony,orm,associations,symfony-forms,Php,Symfony,Orm,Associations,Symfony Forms,我遇到了一个简单的问题。我有一个医生,城市和地区实体。 医生表是指一个城市和一个地区表 在医生表中生成外键city\u id,但未创建area\u id。请帮助我克服这种情况 关系如下: area.orm.yml id: id: type: integer id: true generator: strategy: AUTO fields: area: type: string
id:
id:
type: integer
id: true
generator:
strategy: AUTO
fields:
area:
type: string
length: '100'
cityId:
type: integer
column: city_id
oneToMany:
doctors:
targetEntity: Doctor
mappedBy: area
manyToOne:
city:
targetEntity: City
inversedBy: areas
joinColumn:
name: city_id
referencedColumnName: id
city.orm.yml
id:
id:
type: integer
id: true
generator:
strategy: AUTO
fields:
name:
type: string
length: '100'
oneToMany:
doctors:
targetEntity: Doctor
mappedBy: city
oneToMany:
areas:
targetEntity: Area
mappedBy: city
奥姆医生
id:
id:
type: integer
id: true
generator:
strategy: AUTO
fields:
name:
type: string
length: '30'
degree:
type: string
length: '30'
gender:
type: boolean
length: '1'
speciality:
type: string
length: '100'
yearofexp:
type: integer
length: '2'
accomplishment:
type: text
length: '300'
review:
type: text
length: '200'
contact:
type: integer
length: '11'
address:
type: text
length: '300'
manyToOne:
city:
targetEntity: City
inversedBy: doctors
joinColumn:
name: city_id
referencedColumnName: id
manyToOne:
area:
targetEntity: Area
inversedBy: doctors
joinColumn:
name: area_id
referencedColumnName: id
在ORM文件中删除多个manyTone声明。它应该可以解决这个问题。尝试添加实体的路径,而不仅仅是实体:targetEntity:YourBundle/entity/Area