开发者

Trying to generate tables from Doctrine models and getting MySQL errors

Doctrine_Core::createTablesFromModels() is failing with the following error:

  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('SE开发者_Python百科LECT 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

I think this is happening because it's seeing relationships defined in the models and trying to create constraints. But the tables they're dealing with haven't been created yet. Am I correct in this assumption?

Is there anything I can try to fix it?


After I traced this error to its source, I realized that the culprit was a behavior template that wasn't being "considerate".

Specifically, the behavior was assuming that the table existed while executing its setUp method.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜