我幾乎一字一句地遵循着the documentation,除了我認爲是糾正的兩個調整。CodeIgniter和Doctrine:基表或視圖沒有找到
第一調整:我消除system/application/doctrine.php
冗餘DIRECTORY_SEPARATOR
:
//this produces "...system/application//fixtures"
$config = array('data_fixtures_path' => dirname(__FILE__) . DIRECTORY_SEPARATOR . '/fixtures',
//Replaced with:
$config = array('data_fixtures_path' => dirname(__FILE__) . DIRECTORY_SEPARATOR . 'fixtures',
所得路徑似乎是正確的。
第二次調整:生成的模型(例如models/User.php
)似乎並沒有加載擴展Doctrine_Record
基本模型,所以我想補充一個明確require()
調用每個模型像這樣:
require('generated/BaseUser.php');
class User extends BaseUser { ... }
所以,我的目前存在的問題:當談到時間來建立表的第一次:
$ ./doctrine build-all-reload
build-all-reload - Are you sure you wish to drop your databases? (y/n)
y
build-all-reload - Successfully dropped database for connection named 'mydb'
build-all-reload - Successfully created database for connection named 'mydb'
build-all-reload - Created tables successfully
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'mydb.user' doesn't exist
學說似乎高興地空表,刪除表,刪除數據庫和創建數據庫,但我想不通爲什麼它贏得't 創建表。它清楚地說Created tables successfully
,但SHOW TABLES;
返回「沒有在數據庫中找到表」。
學說正在使用與我相同的MySQL用戶,其中有ALL PRIVILEGES
。
任何想法爲什麼學說不能創建表?希望我只是失明和/或愚蠢。
另外,有沒有我的方式,我可以只生成一個SQL CREATE語句文件的基礎上我的yaml架構或模型,我可以自己運行調試此問題?
這就是解決方案......主義不瞭解基本模型。 'require'根本行不通。 – Dolph 2010-11-01 14:40:28