如何加载带前缀的表类? (例如class models_Table1扩展了Doctrine_Table)

时间:2011-03-13 11:03:59

标签: php doctrine doctrine-1.2

我在文件models_Table1中有一个表类models/Table1

我应该如何指定可以使用前缀model_

列出类的Doctrine 1.2

我在'Doctrine_Exception'中收到以下异常消息“找不到类Table1”在path \ library \ Doctrine \ Table.php:299

堆栈跟踪如下:

#0 path\library\Doctrine\Table.php(256): Doctrine_Table->initDefinition()
#1 path\library\Doctrine\Connection.php(1126): Doctrine_Table->__construct('Table1', Object (Doctrine_Connection_Mysql), true)
#2 path\library\Doctrine\Core.php(1085): Doctrine_Connection->getTable('Table1')
#3 path\application\controllers\test\Doctrine.php(23): Doctrine_Core::getTable('Table1')
...

我试过了:

    $doctrineManager->setAttribute(Doctrine_Core::ATTR_TABLE_CLASS_FORMAT, "models_%s");

但这没有帮助。

只是为了澄清:在DB表名中是Table1

1 个答案:

答案 0 :(得分:0)

我没有尝试过,但是来自文档:

$manager = Doctrine_Manager::getInstance();
$manager->setAttribute(Doctrine_Core::ATTR_TBLNAME_FORMAT, 'model_%s');

this提问