Symfony 一个反射异常上的yml映射

Symfony 一个反射异常上的yml映射,symfony,orm,doctrine-orm,yaml,one-to-one,Symfony,Orm,Doctrine Orm,Yaml,One To One,我遇到了一个小问题,我试图以一对一的关系映射我的实体。 我在使用2.4和Symfony原则。 以下是我的实体: Acme\DemoBundle\Entity\Foo: type: entity oneToOne: bar: targetEntity: Acme\DemoBundle\Entity\Bar joinColumn: name: bar_id referencedColumnName: id table: f

我遇到了一个小问题,我试图以一对一的关系映射我的实体。 我在使用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
我的代码有什么问题

php app/console doctrine:generate:entities Acme\DemoBundle
然后

php app/console doctrine:schema:update --force

如果没有它,它将无法映射任何内容,格式是不相关的。

显示您的
Foo
:)现在添加了整个Foo.orm.yml;-)对不起,我指的是
.php
类文件;)是的,但您必须有
.php
文件虽然您不必选择注释,
.php
文件在这里是必需的,而
YML
用于描述
php
类成员和数据库列之间的绑定(很好,很高兴我能为您指出正确的方向;)