2013-03-17 29 views
0

我使用Doctrine2使用CodeIgniter,我在yml格式創建的一些模型。使用命令行我創建了代理和實體。當我試圖創建數據庫表,我發現了以下錯誤:Doctrine2 +笨和數據庫表的創建問題

[Doctrine\ORM\Mapping\MappingException]
Invalid mapping file 'Entities.category.dcm.yml' for class 'Entities\category'.

這裏的Entities.category.dcm.yml

Entities\Category: 
    type: entity 
    table: categories 
    fields: 
    id: 
     type: integer 
     id: true 
     generator: 
     strategy: AUTO 
    name: 
     type: string 
     length: 50 
     nullable: false 
    description: 
     type: string 
     length: 255 

回答

0

首先,檢查配置是否適合您的實體,爲路徑YML映射驅動程序。

此外,您的Entities.category.dcm.yml包含映射Entities\Category,而不是Entities\category

正如你可以在基地看到FileDriver學說ORM確實爲映射類直接匹配,並在類名不適用正常化。因此Categorycategory是不同的。

+0

文件名中有一個大寫字母C'Entities.Category.dcm.yml' – Bagbyte 2013-03-18 18:45:48

+0

你的實體小寫'C'雖然。 – Ocramius 2013-03-19 09:28:14

+0

從哪裏得到小寫字母c?這是資本在兩個:文件名,並在第一行不是在你的類名的文件 – Bagbyte 2013-03-19 12:40:43