Doctrine_Core::createTablesFromModels() is failing with the following error:
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
Stack trace:
#0 /[removed]/lib/doctrine/Doctrine/Connection.php(1025): Doctrine_Connection->rethrowException(Object(PDOException), Object(Doctrine_Connection_Mysql), 'SELECT a.id...')
#1 /[removed]/lib/doctrine/Doctrine/Query/Abstract.php(976): Doctrine_Connection->execute('SELECT a.id...', Array)
#2 /[removed]/lib/doctrine/Doctrine/Query/Abstract.php(1026): Doctrine_Query_Abstract->_execute(Array)
#3 /[removed]/app/models/behaviors/IdAsConstant.php(16): Doctrine_Query_Abstract->execute()
#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.