2010-08-22 85 views
0

Doctrine_Core :: createTablesFromModels()與下面的錯誤而失敗:試圖生成學說模型表和使MySQL錯誤

  1. Fatal error: Uncaught exception 'Doctrine_Connection_Mysql_Exception' with message 'SQLSTATE[42S02]: Base table or view not found: 1146 Table 'newmexicocreates.address_type' doesn't exist. Failing Query: "SELECT a.id AS a__id, a.title AS a__title FROM address_type a"' in /[removed]/lib/doctrine/Doctrine/Connection.php:1082
  2. Stack trace:
  3. #0 /[removed]/lib/doctrine/Doctrine/Connection.php(1025): Doctrine_Connection->rethrowException(Object(PDOException), Object(Doctrine_Connection_Mysql), 'SELECT a.id...')
  4. #1 /[removed]/lib/doctrine/Doctrine/Query/Abstract.php(976): Doctrine_Connection->execute('SELECT a.id...', Array)
  5. #2 /[removed]/lib/doctrine/Doctrine/Query/Abstract.php(1026): Doctrine_Query_Abstract->_execute(Array)
  6. #3 /[removed]/app/models/behaviors/IdAsConstant.php(16): Doctrine_Query_Abstract->execute()
  7. #4 /[removed]/ in /[removed]/lib/doctrine/Doctrine/Connection.php on line 1082

我認爲這正在發生的事情,因爲它看到在模型中定義的關係,並試圖建立約束。但他們處理的表格尚未創建。我在這個假設中糾正了嗎?

有什麼我可以嘗試修復它嗎?

回答

0

當我把這個錯誤追溯到它的源頭之後,我意識到罪魁禍首是一個不被「體貼」的行爲模板。

具體來說,行爲假定表執行setUp方法時表存在。