我有5个实体和5个映射,我已经完成了大部分的orm映射,而且ik主要工作,但我似乎无法通过验证测试:php bin/console doctrine:schema:validate
这些是我的映射:
file:Organisation.orm.yml
AppBundle\Entity\Organisation:
type: entity
id:
id:
type: integer
generator: { strategy: AUTO }
fields:
# irrelevant fiels
# ...
oneToOne:
creator:
targetEntity: Person
inversedBy: organisation
joinColumn:
name: creator_id
referencedColumnName: id
oneToMany:
vacancies:
targetEntity: Vacancy
mappedBy: id
file:Person.orm.yml
AppBundle\Entity\Person:
type: entity
id:
id:
type: integer
generator: { strategy: AUTO }
fields:
# irrelevant fiels
# ...
oneToOne:
organisation:
targetEntity: Organisation
mappedBy: creator
oneToMany:
testimonials:
targetEntity: Testimonial
mappedBy: receiver_id
manyToMany:
skills:
targetEntity: Skill
mappedBy: null
joinTable:
name: person_has_skill
joinColumns:
-
name: person_id
referencedColumnName: id
inverseJoinColumns:
-
name: skill_id
referencedColumnName: id
file:Skill.orm.yml
AppBundle\Entity\Skill:
type: entity
id:
id:
type: integer
generator: { strategy: AUTO }
fields:
name:
type: string
length: 100
manyToOne:
parent:
nullable: true
targetEntity: Skill
joinColumn:
name: parent_id
referencedColumnName: id
file:Testimonial.orm.yml
AppBundle\Entity\Testimonial:
type: entity
id:
id:
type: integer
generator: { strategy: AUTO }
fields:
value:
type: text
approved:
type: boolean
nullable: true
manyToOne:
sender:
targetEntity: Person
joinColumn:
name: sender_id
referencedColumnName: id
receiver:
targetEntity: Person
joinColumn:
name: receiver_id
referencedColumnName: id
档案:Vacancy.orm.yml
AppBundle\Entity\Vacancy:
type: entity
id:
id:
type: integer
generator: { strategy: AUTO }
fields:
title:
type: string
length: 100
description:
type: text
startdate:
type: datetime
enddate:
type: datetime
manyToOne:
organisation:
targetEntity: Organisation
inversedBy: vacancies
joinColumn:
name: organisation_id
referencedColumnName: id
manyToMany:
skills:
targetEntity: Skill
nullable: true
mappedBy: null
joinTable:
name: vacancy_has_skill
joinColumns:
-
name: vacancy_id
referencedColumnName: id
inverseJoinColumns:
-
name: skill_id
referencedColumnName: id
答案 0 :(得分:0)
在Organisation.orm.yml中我必须设置:
OnetoMany:
vacancies:
targetEntity: Vacancy
mappedBy: organisation