0

I have run into following issue. I have a Symfony 2.1 Application. It runs as two independent instances for two independent customers. The source code is exactly the same. Only the databases are different. Is there any possibility, to configure it like that: Only one instance of symfony and different databases depending from domaint. So Customer A will enter address - customerA.com and it loads application with DatabaseA, and customer B enters address customerB.com and it loads application with DatabaseB. Is this possible? If yes, how to do it?

I run Symfony with Doctrine 2 and MySQL.

1

1 Answer 1

1

This is actually possible. Check out this answer by Wouter J about Compiler passes (Also the linked blog post). Basically it allows you to change the state of any controller right before it is frozen. You could use this to update your doctrine connection parameters or modify the connection.

Last but not least you could also go with a simple onKernelRequest event. Read more about it here.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.