2

What can i do for change my database conection in Symfony?

I have my database.yml with 3 different conection and I want to change "on fly" of database.

Thanks for your help!

1
  • What do you mean by "on the fly"? Do you want to use different databases on different servers, or different connections in the same application? Based on what parameter would they switch? Commented Dec 24, 2010 at 10:38

1 Answer 1

3

You can bind tables to a specific connection - then doctrine creates them there, and whenever you use them, doctrine automatically knows which connection to use.

This example is from The symfony and Doctrine book, chapter 2:

Client:
  connection: master
  columns:
    name: string(255)
    username: string(255)
    password: string(255)
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.