Hi, everybody.

I need to use two different database in my app. I have configurated
app/config.yml like this:

doctrine:
    dbal:
        default_connection: ppuemp
        connections:
            ppuerp:
                driver:   pdo_mysql
                host:     localhost
                dbname:   interpral_ppuerp001
                user:     someuser
                password: somepass

            ppuemp:
                driver:   pdo_mysql
                host:     localhost
                dbname:   interpral_ppuemp
                user:     someuser
                password: somepass
    orm:
        auto_generate_proxy_classes: %kernel.debug%
        default_entity_manager: ppuemp
        entity_managers:
            ppuerp:
                connection: ppuerp
                mappings:
                    AlbatronicIndexBundle: ~
            ppuemp:
                connection: ppuemp
                mappings:
                    AlbatronicAdmonBundle: ~

But if in the controller I only can do (I think) : $em=$this-
>get('doctrine.orm.entity_manager'), How can I change the access from
a database to another?

I tried too:
        $em =  $this->get('doctrine')->getEntityManager();
        $emPpuerp =  $this->get('doctrine')-
>getEntityManager('ppuerp');

But it doesn't work.

I think there must be a way. Because is very frecuent to use more than
one database and change from one to another inside the controller.

Thanks in advance.

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to