Symfony2 Jobeet教程第3天错误映射无效 [英] Symfony2 Jobeet tutorial day 3 error invalid mapping

查看:119
本文介绍了Symfony2 Jobeet教程第3天错误映射无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我用代码生成包实体时

When I generate bundle entities with code

php app/console doctrine:generate:entities EnsJobeetBundle

我收到此错误

[Doctrine \ Common \ Persistence \ Mapping \ MappingException] 类"Ens \ JobeetBundle \ Entity \ Affiliate"的映射文件"Ens.JobeetBundle.Entity.Affiliate.orm.yml"无效.

[Doctrine\Common\Persistence\Mapping\MappingException] Invalid mapping file 'Ens.JobeetBundle.Entity.Affiliate.orm.yml' for class 'Ens\JobeetBundle\Entity\Affiliate'.

这是Affiliate.orm.yml文件:

This is Affiliate.orm.yml file:

 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 ]

推荐答案

尝试在文本编辑器中打开文件,然后在全局范围内将"替换为".

Try opening the file in a text editor, and replacing " " with " " globally.

我的同事在同一文件上遇到了完全相同的问题,事实证明,问题是文件使用空格以外的其他东西作为空格. file(1)表明文件是UTF-8 Unicode文本,而不是纯ASCII.

My colleague was having the exact same issue on the same file, and it turns out the problem was that the file was using something other than spaces as spaces. file(1) showed that the file was a UTF-8 Unicode text rather than plain ASCII.

我相信这可能是由于复制+粘贴的来源使用了不同的空格字符引起的.

I believe this may be caused by the source of the copy + paste using different space characters.

这篇关于Symfony2 Jobeet教程第3天错误映射无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆