我遇到了一个小问题,我试图在一对一的关系中映射我的实体。我正在使用Doctrine 2.4和Symfony。以下是我的实体:
Acme\DemoBundle\Entity\Foo:
type: entity
oneToOne:
bar:
targetEntity: Acme\DemoBundle\Entity\Bar
joinColumn:
name: bar_id
referencedColumnName: id
table: foo_params
fields:
id:
id: true
type: integer
column: id
generator:
strategy: IDENTITY
fooName:
type: string
length: 80
nullable: false
column: foo_name
options:
comment: name of the placeholder for this parameter
fooType:
nullable: false
column: foo_type
Acme\DemoBundle\Entity\Bar:
type: entity
id:
id:
type: integer
column: id
generator:
strategy: IDENTITY例如,当我在Symfony2上运行迁移差异时,我得到的错误是:
[ReflectionException]
Property Acme\DemoBundle\Entity\Foo::$bar does not exist我的代码出了什么问题?
发布于 2014-10-24 17:08:16
php app/console doctrine:generate:entities Acme\DemoBundle然后
php app/console doctrine:schema:update --force没有它它不会映射任何东西,格式是无关紧要的。
https://stackoverflow.com/questions/26543345
复制相似问题