3

コードでバンドル エンティティを生成するとき

php app/console doctrine:generate:entities EnsJobeetBundle

このエラーが発生しています

[Doctrine\Common\Persistence\Mapping\MappingException] クラス「Ens\JobeetBundle\Entity\Affiliate」のマッピング ファイル「Ens.JobeetBundle.Entity.Affiliate.orm.yml」が無効です。

これは Affiliate.orm.yml ファイルです:

 Ens\JobeetBundle\Entity\Affiliate:
  type: entity
  table: affiliate
  id:
    id:
      type: integer
      generator: { strategy: AUTO }
  fields:
    url:
      type: string
      length: 255
    email:
      type: string
      length: 255
      unique: true
    token:
      type: string
      length: 255
    created_at:
      type: datetime
  oneToMany:
    category_affiliates:
      targetEntity: CategoryAffiliate
      mappedBy: affiliate
  lifecycleCallbacks:
    prePersist: [ setCreatedAtValue ]
4

2 に答える 2

1

ファイルをテキスト エディタで開き、" " を " " にグローバルに置き換えてみてください。

私の同僚は同じファイルでまったく同じ問題を抱えていましたが、ファイルがスペース以外のものをスペースとして使用していたことが問題であることが判明しました。file(1)は、ファイルがプレーン ASCII ではなく UTF-8 Unicode テキストであることを示しました。

これは、別のスペース文字を使用したコピーと貼り付けのソースが原因であると考えられます。

于 2013-05-31T14:08:09.480 に答える
0

この yaml .yml 構成ファイルに TAB を含めることはできません。意図としてのスペースのみ。それが問題だ。

于 2014-02-28T12:25:29.940 に答える