我有两个链接在一起的对象:
孩子.orm
OSC\UserBundle\Entity\Child:
type: entity
table: null
repositoryClass: OSC\UserBundle\Entity\ChildRepository
id:
id:
type: integer
id: true
generator:
strategy: AUTO
fields:
firstName:
type: string
length: 255
lastName:
type: string
length: 255
dateOfBirth:
type: datetime
column: dateOfBirth
isPlayer:
type: boolean
default: false
isCoach:
type: boolean
default: false
manyToOne:
parent:
targetEntity: User
inversedBy: children
lifecycleCallbacks: { }
用户.orm
OSC\UserBundle\Entity\User:
type: entity
table: null
repositoryClass: OSC\UserBundle\Entity\UserRepository
fields:
id:
type: integer
id: true
generator:
strategy: AUTO
lastName:
type: string
length: 255
firstName:
type: string
length: 255
streetNumber:
type: string
length: 255
street:
type: string
length: 255
province:
type: string
length: 255
country:
type: string
length: 255
homePhone:
type: string
length: 255
mobilePhone:
type: string
length: 255
isPlayer:
type: boolean
default: false
isCoach:
type: boolean
default: false
dateOfBirth:
type: date
column: dateOfBirth
oneToMany:
children:
targetEntity: Child
mappedBy: parent
oneToMany:
posts:
targetEntity: OSC\BlogBundle\Entity\Post
mappedBy: author
lifecycleCallbacks: { }
我有以下错误,我一直在敲我的头,没有任何线索:
[映射] FAIL - 实体类 'OSC\UserBundle\Entity\Child' 映射无效:
关联OSC\UserBundle\Entity\Child#parent指的是不存在的反边字段OSC\UserBundle\Entity\User#children 。
问题是它被定义了!
我还注意到使用命令教义:generate:entities OSC,我的属性 children 没有被创建......