1. <tfoot id='jnRcL'></tfoot>

      <small id='jnRcL'></small><noframes id='jnRcL'>

        <bdo id='jnRcL'></bdo><ul id='jnRcL'></ul>
    2. <legend id='jnRcL'><style id='jnRcL'><dir id='jnRcL'><q id='jnRcL'></q></dir></style></legend>
    3. <i id='jnRcL'><tr id='jnRcL'><dt id='jnRcL'><q id='jnRcL'><span id='jnRcL'><b id='jnRcL'><form id='jnRcL'><ins id='jnRcL'></ins><ul id='jnRcL'></ul><sub id='jnRcL'></sub></form><legend id='jnRcL'></legend><bdo id='jnRcL'><pre id='jnRcL'><center id='jnRcL'></center></pre></bdo></b><th id='jnRcL'></th></span></q></dt></tr></i><div id='jnRcL'><tfoot id='jnRcL'></tfoot><dl id='jnRcL'><fieldset id='jnRcL'></fieldset></dl></div>

    4. symfony 2.3 中与学说的多重联系

      时间:2024-08-15
          <bdo id='OnCrt'></bdo><ul id='OnCrt'></ul>

            <tfoot id='OnCrt'></tfoot>
          1. <small id='OnCrt'></small><noframes id='OnCrt'>

            <legend id='OnCrt'><style id='OnCrt'><dir id='OnCrt'><q id='OnCrt'></q></dir></style></legend>

                <tbody id='OnCrt'></tbody>
                <i id='OnCrt'><tr id='OnCrt'><dt id='OnCrt'><q id='OnCrt'><span id='OnCrt'><b id='OnCrt'><form id='OnCrt'><ins id='OnCrt'></ins><ul id='OnCrt'></ul><sub id='OnCrt'></sub></form><legend id='OnCrt'></legend><bdo id='OnCrt'><pre id='OnCrt'><center id='OnCrt'></center></pre></bdo></b><th id='OnCrt'></th></span></q></dt></tr></i><div id='OnCrt'><tfoot id='OnCrt'></tfoot><dl id='OnCrt'><fieldset id='OnCrt'></fieldset></dl></div>
                本文介绍了symfony 2.3 中与学说的多重联系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                所以我试图在我的 symfony 项目中与教义建立多重联系.

                So I'm trying to do a multiple connection with doctrine in my symfony project.

                首先,我只使用一个数据库,然后我需要添加另一个.

                First, I was only using one database, then I needed to add another.

                这是以前的:

                # Doctrine Configuration
                doctrine:
                  dbal:
                    default_connection: extranet
                    connections:
                        extranet:
                            driver:   pdo_mysql
                            host:     "%db_extranet_host%"
                            port:     "%db_extranet_port%"
                            dbname:   "%db_extranet_name%"
                            user:     "%db_extranet_user%"
                            password: "%db_extranet_password%"
                            charset:  UTF8
                orm:
                    auto_generate_proxy_classes: "%kernel.debug%"
                    entity_managers:
                        extranet:
                            naming_strategy: doctrine.orm.naming_strategy.underscore
                            auto_mapping: true
                

                一切正常

                然后我添加了抓取"数据库:

                THEN I added the "crawl" database :

                # Doctrine Configuration
                doctrine:
                  dbal:
                    default_connection: extranet
                    connections:
                        extranet:
                            driver:   pdo_mysql
                            host:     "%db_extranet_host%"
                            port:     "%db_extranet_port%"
                            dbname:   "%db_extranet_name%"
                            user:     "%db_extranet_user%"
                            password: "%db_extranet_password%"
                            charset:  UTF8
                        crawl:
                            driver:   pdo_mysql
                            host:     "%db_crawl_host%"
                            port:     "%db_crawl_port%"
                            dbname:   "%db_crawl_name%"
                            user:     "%db_crawl_user%"
                            password: "%db_crawl_password%"
                            charset:  UTF8
                orm:
                    auto_generate_proxy_classes: "%kernel.debug%"
                    default_entity_manager: extranet
                    entity_managers:
                        extranet:
                            connection: extranet
                            naming_strategy: doctrine.orm.naming_strategy.underscore
                            mappings:
                                AppBundle: ~
                        crawl:
                            connection: crawl
                            naming_strategy: doctrine.orm.naming_strategy.underscore
                            mappings:
                                DbBccCrawlBundle: ~
                

                我摆脱了 auto_mapping &添加了一些东西

                I got rid of the auto_mapping & added few things

                但是,现在我失去了与外联网的连接(例如,用户无法再登录)

                BUT, now I lost connection to extranet (users can't loggin anymore for example)

                有什么想法吗?(如果你读到那么远,谢谢;))

                Any ideas? (and thanks if you read that far ;) )

                编辑

                遵循 http://symfony.com/doc/2.3/reference/configuration/doctrine.html#mapping-entities-outside-of-a-bundle 我尝试使用相同的语法:

                following http://symfony.com/doc/2.3/reference/configuration/doctrine.html#mapping-entities-outside-of-a-bundle I tried to have the same syntax :

                orm:
                    # auto_generate_proxy_classes: "%kernel.debug%"
                    default_entity_manager: extranet
                    # auto_mapping: true
                    mappings:
                        AppBundle:
                            type: annotation
                            dir: '%kernel.root_dir%/../src/AppBundle/Entity'
                            prefix: AppBundleEntity
                            alias: App
                        DbBccCrawlBundle:
                            type: annotation
                            dir: '%kernel.root_dir%/../src/DbBccCrawlBundle/Entity'
                            prefix: DbBccCrawlBundleEntity
                            alias: Crawl
                

                还是不行……

                编辑 2

                orm:
                    auto_generate_proxy_classes: "%kernel.debug%"
                    default_entity_manager: extranet
                    entity_managers:
                        auto_mapping: true
                        extranet:
                            connection: extranet
                            naming_strategy: doctrine.orm.naming_strategy.underscore
                            mappings:
                                AppBundle:
                                    type:   annotation
                                    # dir:    '%kernel.root_dir%/../src/AppBundle/Entity'
                                    # prefix: AppBundleEntity
                                    alias:  App
                        crawl:
                            connection: crawl
                            naming_strategy: doctrine.orm.naming_strategy.underscore
                            mappings:
                                DbBccCrawlBundle:
                                    type:   annotation
                                    # dir:    '%kernel.root_dir%/../src/DbBccCrawlBundle/Entity'
                                    # prefix: DbBccCrawlBundleEntity
                                    alias:  Crawl
                

                也不行

                推荐答案

                我不知道为什么/如何,但它有效

                I donno why/how but it works

                代码如下:

                orm:
                    auto_generate_proxy_classes: "%kernel.debug%"
                    entity_managers:
                        extranet:
                            naming_strategy: doctrine.orm.naming_strategy.underscore
                            auto_mapping: true
                        crawl:
                            naming_strategy: doctrine.orm.naming_strategy.underscore
                            connection: crawl
                            mappings:
                                DbBccCrawlBundle: ~
                

                问题是我一开始就尝试过,但失败了(在...中找不到类 X)

                the thing is that I tried that at the start and it failed (the class X not found in...)

                如果有人有解释,我会非常乐意阅读.

                If anyone has an explenation, I'll be more than happy to read it.

                还是谢谢

                这是问题的第二部分,下面是开始:类在链配置的命名空间中找不到X"...当我尝试与学说进行多重连接时

                This was the 2nd part of the question, here's the begening : The class 'X' was not found in the chain configured namespaces ... when I try a multiple connection with doctrine

                这篇关于symfony 2.3 中与学说的多重联系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:运行 Doctrine 转换映射时跳过表 下一篇:如何在 yml 映射的实体中配置 VichUploader?

                相关文章

                <i id='p9Dvz'><tr id='p9Dvz'><dt id='p9Dvz'><q id='p9Dvz'><span id='p9Dvz'><b id='p9Dvz'><form id='p9Dvz'><ins id='p9Dvz'></ins><ul id='p9Dvz'></ul><sub id='p9Dvz'></sub></form><legend id='p9Dvz'></legend><bdo id='p9Dvz'><pre id='p9Dvz'><center id='p9Dvz'></center></pre></bdo></b><th id='p9Dvz'></th></span></q></dt></tr></i><div id='p9Dvz'><tfoot id='p9Dvz'></tfoot><dl id='p9Dvz'><fieldset id='p9Dvz'></fieldset></dl></div>
                • <bdo id='p9Dvz'></bdo><ul id='p9Dvz'></ul>
                1. <small id='p9Dvz'></small><noframes id='p9Dvz'>

                  1. <legend id='p9Dvz'><style id='p9Dvz'><dir id='p9Dvz'><q id='p9Dvz'></q></dir></style></legend>
                    <tfoot id='p9Dvz'></tfoot>