2013-05-18 52 views
3

當我生成具有代碼束實體Symfony2的Jobeet的教程天3出錯無效映射

php app/console doctrine:generate:entities EnsJobeetBundle 

我得到這個誤差

[學說\共同\持久性\映射\ 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 ] 
+0

您應該正確縮進您的yml文件 – cheesemacfly

+0

該教程在哪裏?(url) – mpm

+0

http://www.ens.ro/2012/03/21/jobeet-tutorial-with-symfony2/ – tasqyn

回答

1

嘗試打開該文件在文本編輯器,並更換 「」 與 「」 全球。

我的同事在同一個文件上遇到了完全相同的問題,事實證明問題在於該文件使用空格以外的空格作爲空格。 file(1)顯示該文件是UTF-8 Unicode文本而不是純ASCII。

我相信這可能是由複製+粘貼源使用不同的空格字符造成的。

+0

仍然有同樣的問題。 –

0

這個yaml .yml配置文件不能包含TAB。只有空間作爲intendation。那就是問題所在。