2010-02-24 29 views
2

所以,我試圖用Doctrine檢索一些數據。我有這樣的基本代碼:爲什麼不能Doctrine檢索我的模型數據?

$conn = Doctrine_Manager::connection(CONNECTION_STRING); 
$site = Doctrine_Core::getTable('Site')->find('00024'); 
echo $site->SiteName; 

但是,這一直拋出一個SQL錯誤,'列siteid不存在'。當我看到異常的SQL查詢是這樣的(你可以看到的錯誤是,SITEID的inner_tbl別名設置爲s__siteid,所以查詢inner_tabl.siteid是什麼地方不對頭):

SELECT TOP 1 
    [inner_tbl].[siteid] AS [s__siteid] 
FROM 
    (SELECT TOP 1 
     [s].[siteid] AS [s__siteid], 
     [s].[name] AS [s__name], 
     [s].[address] AS [s__address], 
     [s].[city] AS [s__city], 
     [s].[zip] AS [s__zip], 
     [s].[state] AS [s__state], 
     [s].[region] AS [s__region], 
     [s].[callprocessor] AS [s__callprocessor], 
     [s].[active] AS [s__active], [s].[dateadded] AS [s__dateadded] 
    FROM [Sites] [s] 
    WHERE ([s].[siteid] = '00024') 
    ) AS [inner_tbl] 

爲什麼查詢通過這種方式生成?這可能是Yaml架構的佈局方式嗎?

Site: 
    connection: 0 
    tableName: Sites 
    columns: 
    siteid: 
     type: string(5) 
     fixed: true 
     unsigned: false 
     primary: true 
     autoincrement: false 
    name: 
     type: string(300) 
     fixed: false 
     unsigned: false 
     notnull: true 
     primary: false 
     autoincrement: false 
    address: 
     type: string(100) 
     fixed: false 
     unsigned: false 
     notnull: false 
     primary: false 
     autoincrement: false 
    city: 
     type: string(100) 
     fixed: false 
     unsigned: false 
     notnull: false 
     primary: false 
     autoincrement: false 
    zip: 
     type: string(5) 
     fixed: false 
     unsigned: false 
     notnull: false 
     primary: false 
     autoincrement: false 
    state: 
     type: string(2) 
     fixed: true 
     unsigned: false 
     notnull: true 
     primary: false 
     autoincrement: false 
    region: 
     type: integer(4) 
     fixed: false 
     unsigned: false 
     notnull: true 
     default: (5) 
     primary: false 
     autoincrement: false 
    callprocessor: 
     type: integer(4) 
     fixed: false 
     unsigned: false 
     notnull: true 
     primary: false 
     autoincrement: false 
    active: 
     type: integer(1) 
     fixed: false 
     unsigned: false 
     notnull: true 
     primary: false 
     autoincrement: false 
    dateadded: 
     type: timestamp(16) 
     fixed: false 
     unsigned: false 
     notnull: true 
     default: (getdate()) 
     primary: false 
     autoincrement: false 
+0

這是什麼DBMS? –

回答

0

我跟在IRC房開發商(喬納森工資)之一,他說,SQL可以工作,但也有可能是錯誤(我假設這是一個)。他還表示,Doctrine是專門爲MySQL編寫的。

相關問題