0
votes

I'm trying to use an Xhprof bundle in conjunction with XhGUI. I've have two separate databases for my app, one for the actual domain models(postgres) and one to store the profiling data(mysql).

I've created two connections and entity managers in the my config.yml to account for this. I'm having trouble with the mapping now though because two of my bundles have entities that extend entities in 3rd party bundles. The configurations/annotations found in the base classes isn't being picked up by doctrine though. The 3rd party bundles use annotations for the orm configuration so in my classes that extend those, i chose annotation as well.

MyCompanyAuthBundle has entities that extend entities in the FOSOAuthServerBundle bundle. MyCompanyProfileBundle has one entity that extends an entity in the JnsXhprofBundle bundle.

Now that i'm having to manually configure the mappings sections in my config.yml, i can't figure out how to tell doctrine to also use the entities base class annotation configuration found in the 3rd party bundles.

Before i started trying to use two connections, i just used the auto_mapping flag in the orm config and it worked great with my single connection.

Anyone know what i'm doing wrong here?

Here is the doctrine part of my config.yml.

doctrine:
    dbal:
        default_connection: default
        connections:
            default:
                driver:   "%database_driver%"
                host:     "%database_host%"
                port:     "%database_port%"
                dbname:   %database_name%_%kernel.environment%
                user:     "%database_user%"
                password: "%database_password%"
                charset:  UTF8

            xhprof:
                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:
                    MyCompanyCoreBundle:  ~
                    MyCompanyAuthBundle:
                        type: annotation
            xhprof:
                connection: xhprof
                mappings:
                    MyCompanyProfileBundle: ~
                    JnsXhprofBundle: ~
1

1 Answers

0
votes

Figured it out. Easier than i expected!

Just needed to add the bundles that also have mapping.

My working config.yml

doctrine:
    dbal:
        default_connection: default
        connections:
            default:
                driver:   "%database_driver%"
                host:     "%database_host%"
                port:     "%database_port%"
                dbname:   %database_name%_%kernel.environment%
                user:     "%database_user%"
                password: "%database_password%"
                charset:  UTF8

            xhprof:
                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:
                    MyCompanyCoreBundle:  ~
                    MyCompanyAuthBundle: ~
                    FOSOAuthServerBundle: ~
            xhprof:
                connection: xhprof
                mappings:
                    MyCompanyProfileBundle: ~
                    JnsXhprofBundle: ~