我在Postgresql 9.0中有一個數據庫,我試圖使用Doctrine ORM 1.2從數據庫生成模型。Doctrine和Postgresql,從數據庫生成模型問題
這裏是我的代碼:
<?php
require_once 'Doctrine.php';
spl_autoload_register(array('Doctrine', 'autoload'));
spl_autoload_register(array('Doctrine_Core', 'modelsAutoload'));
$manager = Doctrine_Manager::getInstance();
$conn = Doctrine_Manager::connection('pgsql://postgres:[email protected]/erp','doctrine');
$conn->setAttribute(Doctrine_Core::ATTR_PORTABILITY, Doctrine_Core::PORTABILITY_FIX_CASE | PORTABILITY_RTM);
$conn->setAttribute(Doctrine_Core::ATTR_QUOTE_IDENTIFIER, true);
$manager->setAttribute(Doctrine_Core::ATTR_AUTO_ACCESSOR_OVERRIDE, true);
Doctrine_Core::loadModels('../application/models');
Doctrine_Core::generateModelsFromDb('../application/models', array('doctrine'), array('generateTableClasses' => true));
?>
,當我運行頁面,我得到這個錯誤:
Fatal error: Uncaught exception 'Doctrine_Connection_Pgsql_Exception' with message 'SQLSTATE[42P01]: Undefined table: 7 ERROR: missing FROM-clause entry for table "t" LINE 6: ... t.typtype ... ^. Failing Query: "SELECT ordinal_position as attnum, column_name as field, udt_name as type, data_type as complete_type, t.typtype AS typtype, is_nullable as isnotnull, column_default as default, (SELECT 't' in D:\Doctrine-1.2.3\Doctrine-1.2.3\Doctrine\Connection.php on line 1082
值得一提,這個代碼是可以正常使用的MySQL(具有mysql:// ...在連接中),但無法使它與postgresql 9.0一起工作。
有什麼想法?
yeppy那裏有一個錯誤的源文件!我很驚訝我已經從SVN下載了源代碼,但仍然存在錯字!我已經刪除了自己!但是,無論如何 – Pooria 2010-11-21 15:52:50