Load different Database Symfony2 Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of Load different Database Symfony2 without wasting too much if your time.

The question is published on by Tutorial Guruji team.

How can I load different database for production and development environment ?

In parameters.yml I have the main database configuration, but I don’t know how to add the dev database with differets parameters.

I’m looking for this on Google but I can’t find any help.

Maybe with config_dev.yml and config_prod.yml? but I’m not sure how to do that.

Any help would be appreciated. Thanks.


I will do something like this:

Files hierarchy: 1) parameters.yml – for common parameters 2) create parameters_dev.yml – only dev db connection params 3) create parameters_prod.yml – only prod db connection params

In head of config files: 1) config.yml

    - { resource: parameters.yml }

2) config_dev.yml

    - { resource: config.yml }
    - { resource: parameters_dev.yml }

3) config_prod.yml

    - { resource: config.yml }
    - { resource: parameters_prod.yml}
We are here to answer your question about Load different Database Symfony2 - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji