使用Symfony2创建多租户应用程序

I am trying to create a multi tenant application using Symfony2.

Does anybody know how to select the database to connect to based on the domain the application is reached through? eg. company1.domain.com => db1, company2.domain.com => db2

I have found plugins that may help like sfMultiTenantPlugin, but all seem to have drawbacks.

I just need the parameters.ini file to have a different database_name value based on the domain.

Perhaps something like this? Here

Then use a switch to assign your connection variables.

case "company1.domain.com":
  $dbname = `db1`;
  etc.

(I have no experience with Symfony2, but it sounded like this was outside that. I could be wrong.)
Hope this helps.