Cross数据库在PHP中与Doctrine连接

时间:2013-03-13 15:35:02

标签: php symfony doctrine-orm doctrine multiple-databases

我在他们的博客上阅读Doctrine中的跨数据库连接:http://www.doctrine-project.org/blog/cross-database-joins.html 问题是每当表名包含一个点(用于指定数据库)时,doctrine:schema:update输出Nothing to update - your database is already in sync with the current entity metadata.该命令基本上只是忽略表名包含点的实体。

1 个答案:

答案 0 :(得分:3)

这是正常的,它是ORM / DBAL的限制。

Doctrine\ORM\Tools\SchemaTool使用schema manager retrieved from your current connection

Doctrine\DBAL\Schema\AbstractSchemaManager读取表from the current connection's db,而不是所有数据库。

因此,您必须手动处理放置在不同数据库中的表,或者使用您自己的架构管理器和您自己的listTables实现。