0

I am using single database connection. Now I need to use two database connection. I need to know the steps to create two databases. I have lot of doubts. Generate entity commands are same what we using for single db connection or not.

Please explain step by step process for creating multiple entities and multiple db connection.

In /Symfony/app/config/config.yml i write the code:

doctrine:
dbal:
    default_connection:   default
    connections:
        default:
            driver:   %database_driver%
            host:     %database_host%
            port:     %database_port%
            dbname:   %database_name%
            user:     %database_user%
            password: %database_password%
            charset:  UTF8
        customer:
            driver:   %database_driver2%
            host:     %database_host2%
            port:     %database_port2%
            dbname:   %database_name2%
            user:     %database_user2%
            password: %database_password2%
            charset:  UTF8

orm:
    default_entity_manager:   default
    entity_managers:
        default:
            connection:       default
            mappings:
                dbBundle: ~
        client:
            connection:       client
            mappings:
                dbBundle: ~
j0k
  • 22,600
  • 28
  • 79
  • 90
Niju
  • 29
  • 2
  • 8
  • If i use this command to generate entity : php app/console doctrine:mapping:convert yml ./src/MyCo/Base/ MyBundle/Resources/config/doctrine/metadata/orm --from-database --force --em=client : Error Disapled like : [InvalidArgumentException] Bundle "dbBundle" does not exist or it is not enabled. – Niju Mar 02 '13 at 06:54
  • How can i generate entity it display the error ? Is there any solution ? – Niju Mar 04 '13 at 04:54

1 Answers1

0

I found the answer : Add namespace before the bundle name

orm:
    default_entity_manager:   default
    entity_managers:
        default:
            connection:       default
            mappings:
                <Namespace>dbBundle: ~
        client:
            connection:       client
            mappings:
                 <Namespace>dbBundle: ~
Niju
  • 29
  • 2
  • 8