【发布时间】:2013-12-18 02:09:42
【问题描述】:
我是从 Symfony2 开始的,我也是从 Doctrine2 开始的。
我想使实体双向,但我不知道我做错了什么。这是我的两个 .orm.yml 文件:
Categorie.orm.yml:
MY\SUPERBundle\Entity\Categorie:
type: entity
fields:
id:
id: true
type: integer
generator:
strategy: AUTO
nomCategorie:
type: text
nullable: true
column: NomCategorie
oneToMany:
SousCategories:
targetEntity: MY\SUPERBundle\Entity\SousCategorie
mappedBy: Categorie
SousCategorie.orm.yml:
MY\SUPERBundle\Entity\SousCategorie:
type: entity
fields:
id:
id: true
type: integer
generator:
strategy: AUTO
nomSousCategorie:
type: text
nullable: true
column: NomSousCategorie
manyToOne:
Categorie:
targetEntity: MY\SUPERBundle\Entity\Categorie
inversedBy: SousCategories
joinColumns:
categorie_id:
referencedColumnName: id
nullable: false
当我想运行命令时:
doctrine:schema:update --dump-sql
我收到此错误:
[ReflectionException]
Property MY\SUPERBundle\Entity\Categorie::$SousCategories does not exist
如果你们对我做错了什么有任何提示,我将非常感激。
谢谢!
【问题讨论】:
-
这似乎不是解决方案,但您的属性“SousCategories”不应大写。
标签: symfony doctrine-orm mapping yaml bidirectional