2011-07-13 48 views
2

我使用codeigniter和CodeIgniter2一起使用Doctrine 2。 我使用YAML Schema文件來定義數據庫模式。 我想用MySQL數據類型Double在我的表中定義兩列。 下面是YAML映射我試圖Doctrine 2 - MySQL數據類型Double在YAML中

Entities\Location: 
    type: entity 
    table: locations 
    fields: 
    id: 
     type: integer 
     id: true 
     generator: 
     strategy: AUTO 
    Name: 
     type: string 
     length: 40 
     nullable: false 
    longitude: 
     type: double 
    latitude: 
     type: double 

但代碼拋出錯誤,當我嘗試從YAML創建模型。

實體已成功創建。

錯誤消息是:

類雙不存在試圖創建代理

未知列double類型要求,而試圖創建模式

回答

2

1.2我認爲這是'浮動'或'小數'。嘗試其中之一。

以下是對1.2文檔的參考......我很努力地找到說明相同內容的2.x文檔。

http://www.doctrine-project.org/projects/orm/1.2/docs/manual/defining-models/pl

+0

謝謝。我能夠在YAML中以類型** float float成功創建模式。 生成的數據庫表字段是雙倍的,就像我想要的那樣:-) – rineez

+1

好,我很高興。我覺得很奇怪,沒有一個例子看起來像使用float類型。 :) – brindy

+1

僅供參考,關於doctrine 2類型的文檔可以在這裏找到:http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/basic-mapping.html #主義映射類型 –