Multiple databases support in Symfony

这一生的挚爱 提交于 2019-11-29 05:12:56

I got this issue working! The most important thing is you must name your schema according to %dbname%.schema.yml. In this way Symfony will be able to assign the ymls to the correct database.

Also when running the task you should specify the connection for example:

symfony propel:build-all-load --connection=my_connection

This worked for me, hope it helps.

You can also use Propel::getConnection('db2') to manually retrieve a connection.

Just have in mind that what you call "db1", "db2" are the connection names. You can have several connections to a same database with various login/permissions (like read only etc.).

It's very good for testing purpose: you can do it with the same connection name with a different database. No way to crash your production database with that :)

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!