pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

      • <bdo id='wPsP9'></bdo><ul id='wPsP9'></ul>
      <legend id='wPsP9'><style id='wPsP9'><dir id='wPsP9'><q id='wPsP9'></q></dir></style></legend>
      <tfoot id='wPsP9'></tfoot>
      <i id='wPsP9'><tr id='wPsP9'><dt id='wPsP9'><q id='wPsP9'><span id='wPsP9'><b id='wPsP9'><form id='wPsP9'><ins id='wPsP9'></ins><ul id='wPsP9'></ul><sub id='wPsP9'></sub></form><legend id='wPsP9'></legend><bdo id='wPsP9'><pre id='wPsP9'><center id='wPsP9'></center></pre></bdo></b><th id='wPsP9'></th></span></q></dt></tr></i><div class="h5frnrb" id='wPsP9'><tfoot id='wPsP9'></tfoot><dl id='wPsP9'><fieldset id='wPsP9'></fieldset></dl></div>

    1. <small id='wPsP9'></small><noframes id='wPsP9'>

        Zend Framework 2 和 Doctrine 2 - 多個(gè)數(shù)據(jù)庫的配置

        Zend Framework 2 and Doctrine 2 - Configuration for multiple databases(Zend Framework 2 和 Doctrine 2 - 多個(gè)數(shù)據(jù)庫的配置)
        <tfoot id='E4VrQ'></tfoot>
      1. <i id='E4VrQ'><tr id='E4VrQ'><dt id='E4VrQ'><q id='E4VrQ'><span id='E4VrQ'><b id='E4VrQ'><form id='E4VrQ'><ins id='E4VrQ'></ins><ul id='E4VrQ'></ul><sub id='E4VrQ'></sub></form><legend id='E4VrQ'></legend><bdo id='E4VrQ'><pre id='E4VrQ'><center id='E4VrQ'></center></pre></bdo></b><th id='E4VrQ'></th></span></q></dt></tr></i><div class="tjv5dfp" id='E4VrQ'><tfoot id='E4VrQ'></tfoot><dl id='E4VrQ'><fieldset id='E4VrQ'></fieldset></dl></div>

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

        • <bdo id='E4VrQ'></bdo><ul id='E4VrQ'></ul>
                  <tbody id='E4VrQ'></tbody>

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

                  本文介紹了Zend Framework 2 和 Doctrine 2 - 多個(gè)數(shù)據(jù)庫的配置的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  我將配置文件中的代碼粘貼到

                  I pasted the code from the configuration.md file to

                  module.config.php

                  module.config.php

                  'doctrine' => array(
                          'connection' => array(
                              'orm_crawler' => array(
                                  'driverClass' => 'DoctrineDBALDriverPDOMySqlDriver',
                                  'params' => array(
                                      'host'     => 'localhost',
                                      'port'     => '3306',
                                      'user'     => 'root',
                                      'password' => 'root',
                                      'dbname'   => 'crawler',
                                      'driverOptions' => array(
                                          1002 => 'SET NAMES utf8'
                                      ),
                                  )
                              )
                          ),
                  
                          'configuration' => array(
                              'orm_crawler' => array(
                                  'metadata_cache'    => 'array',
                                  'query_cache'       => 'array',
                                  'result_cache'      => 'array',
                                  'driver'            => 'orm_crawler',
                                  'generate_proxies'  => true,
                                  'proxy_dir'         => 'data/DoctrineORMModule/Proxy',
                                  'proxy_namespace'   => 'DoctrineORMModuleProxy',
                                  'filters'           => array()
                              )
                          ),
                  
                          'driver' => array(
                              'Crawler_Driver' => array(
                                  'class' => 'DoctrineORMMappingDriverAnnotationDriver',
                                  'cache' => 'array',
                                  'paths' => array(
                                      __DIR__ . '/../src/Crawler/Entity'
                                  )
                              ),
                              'orm_crawler' => array(
                                  'class'   => 'DoctrineORMMappingDriverDriverChain',
                                  'drivers' => array(
                                      'CrawlerEntity' =>  'Crawler_Driver'
                                  )
                              ),
                          ),
                  
                          'entitymanager' => array(            
                              'orm_crawler' => array(
                                  'connection'    => 'orm_crawler',
                                  'configuration' => 'orm_crawler'
                              )
                          ),
                  
                          'eventmanager' => array(
                              'orm_crawler' => array()
                          ),
                  
                          'sql_logger_collector' => array(
                              'orm_crawler' => array(),
                          ),
                  
                          'entity_resolver' => array(
                              'orm_crawler' => array()
                          ),
                  
                      ),
                  

                  ```

                  模塊.php

                  public function getServiceConfig()
                  {
                      return array(
                          'factories' => array(
                  'doctrine.authenticationadapter.orm_crawler'  => new DoctrineModuleServiceAuthenticationAdapterFactory('orm_crawler'),
                                  'doctrine.authenticationstorage.orm_crawler'  => new DoctrineModuleServiceAuthenticationStorageFactory('orm_crawler'),
                                  'doctrine.authenticationservice.orm_crawler'  => new DoctrineModuleServiceAuthenticationAuthenticationServiceFactory('orm_crawler'),
                  
                                  'doctrine.connection.orm_crawler'             => new DoctrineORMModuleServiceDBALConnectionFactory('orm_crawler'),
                                  'doctrine.configuration.orm_crawler'          => new DoctrineORMModuleServiceConfigurationFactory('orm_crawler'),
                                  'doctrine.entitymanager.orm_crawler'          => new DoctrineORMModuleServiceEntityManagerFactory('orm_crawler'),
                  
                                  'doctrine.driver.orm_crawler'                 => new DoctrineModuleServiceDriverFactory('orm_crawler'),
                                  'doctrine.eventmanager.orm_crawler'           => new DoctrineModuleServiceEventManagerFactory('orm_crawler'),
                                  'doctrine.entity_resolver.orm_crawler'        => new DoctrineORMModuleServiceEntityResolverFactory('orm_crawler'),
                                  'doctrine.sql_logger_collector.orm_crawler'   => new DoctrineORMModuleServiceSQLLoggerCollectorFactory('orm_crawler'),
                                  'doctrine.mapping_collector.orm_crawler'      => function (endServiceManagerServiceLocatorInterface $sl) {
                                      $em = $sl->get('doctrine.entitymanager.orm_crawler');
                  
                                      return new DoctrineORMModuleCollectorMappingCollector($em->getMetadataFactory(), 'orm_crawler_mappings');
                                  },
                                  'DoctrineORMModuleFormAnnotationAnnotationBuilder' => function(endServiceManagerServiceLocatorInterface $sl) {
                                      return new DoctrineORMModuleFormAnnotationAnnotationBuilder($sl->get('doctrine.entitymanager.orm_crawler'));
                                  },
                          ),
                      );
                  }
                  

                  我收到以下錯(cuò)誤:

                  C:xamppvhostszf2-tradevendorzendframeworkzendframeworklibraryendServiceManagerServiceManager.php:529
                  

                  留言:

                  ZendMvcControllerPluginManager::get was unable to fetch or create an instance for getServiceManager
                  

                  我做錯(cuò)了什么?請(qǐng)幫忙.

                  What am I doing wrong? Please help.

                  問候馬修

                  推薦答案

                  Mac,歡迎使用 stackoverflow!您不需要為每個(gè)連接分別定義自定義工廠.DoctrineORMModule 已經(jīng)為我們處理了這項(xiàng)工作.

                  Mac, welcome to stackoverflow! You don't need to define custom factories for each connection respectively. DoctrineORMModule already handles this job for us.

                  當(dāng)您需要實(shí)體管理器時(shí),通過在別名中使用它們的名稱從服務(wù)定位器實(shí)例中獲取它,如下所示:

                  When you need the entity managers, get it from service locator instance by using their names in the alias like this:

                  $this->getServiceLocator()->get('doctrine.entitymanager.orm_default');
                  

                  $this->getServiceLocator()->get('doctrine.entitymanager.orm_alternative');
                  

                  我正在分享我當(dāng)前應(yīng)用程序的數(shù)據(jù)庫配置之一,該配置當(dāng)前同時(shí)使用 PostgreSQL 和 MySQL 連接.

                  I'm sharing one of my current application's database configuration which currently uses both PostgreSQL and MySQL connections.

                  <?php
                  return array(
                      'doctrine' => array(
                          'connection' => array(
                              // Default DB connection
                              'orm_default' => array(
                                  'driverClass' => 'DoctrineDBALDriverPDOPgSqlDriver',
                                  'params' => array(
                                      'host' => '1.2.3.4',
                                      'user' => 'pdbuser',
                                      'port' => '5432',
                                      'password' => '****',
                                      'dbname' => 'mydb',
                                      'driver' => 'pdo_pgsql',
                                  ),
                              ),
                  
                              // Alternative DB connection
                              'orm_alternative' => array(
                                  'driverClass' => 'DoctrineDBALDriverPDOMySqlDriver',
                                  'params' => array(
                                      'host' => '4.5.6.7',
                                      'user' => 'dbuser',
                                      'port' => '3306',
                                      'password' => '****',
                                      'dbname' => 'mydb',
                                      'driver' => 'pdo_mysql',
                                  ),
                              ),
                          ),
                  
                          // Entity Manager instantiation settings
                          'entitymanager' => array(
                              'orm_default' => array(
                                  'connection'    => 'orm_default',
                                  'configuration' => 'orm_default',
                              ),
                              'orm_alternative' => array(
                                  'connection'    => 'orm_alternative',
                                  'configuration' => 'orm_alternative',
                              ),
                          ),
                  
                          // Use array cache locally, also auto generate proxies on development environment.
                          'configuration' => array(
                              'orm_default' => array(
                                  'metadata_cache' => 'array',
                                  'query_cache' => 'array',
                                  'result_cache' => 'array',
                                  'hydration_cache' => 'array',
                                  'generate_proxies' => true,
                              ),
                              'orm_alternative' => array(
                                  'metadata_cache' => 'array',
                                  'query_cache' => 'array',
                                  'result_cache' => 'array',
                                  'hydration_cache' => 'array',
                                  'generate_proxies' => true,
                              ),
                          ),
                      ),
                  );
                  

                  您可以輕松地將此配置與您的配置合并.

                  You can easily merge this configuration with yours.

                  希望有幫助.

                  這篇關(guān)于Zend Framework 2 和 Doctrine 2 - 多個(gè)數(shù)據(jù)庫的配置的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  Deadlock exception code for PHP, MySQL PDOException?(PHP、MySQL PDOException 的死鎖異常代碼?)
                  PHP PDO MySQL scrollable cursor doesn#39;t work(PHP PDO MySQL 可滾動(dòng)游標(biāo)不起作用)
                  PHP PDO ODBC connection(PHP PDO ODBC 連接)
                  Using PDO::FETCH_CLASS with Magic Methods(使用 PDO::FETCH_CLASS 和魔術(shù)方法)
                  php pdo get only one value from mysql; value that equals to variable(php pdo 只從 mysql 獲取一個(gè)值;等于變量的值)
                  MSSQL PDO could not find driver(MSSQL PDO 找不到驅(qū)動(dòng)程序)
                1. <i id='CnY0d'><tr id='CnY0d'><dt id='CnY0d'><q id='CnY0d'><span id='CnY0d'><b id='CnY0d'><form id='CnY0d'><ins id='CnY0d'></ins><ul id='CnY0d'></ul><sub id='CnY0d'></sub></form><legend id='CnY0d'></legend><bdo id='CnY0d'><pre id='CnY0d'><center id='CnY0d'></center></pre></bdo></b><th id='CnY0d'></th></span></q></dt></tr></i><div class="zzfpdf5" id='CnY0d'><tfoot id='CnY0d'></tfoot><dl id='CnY0d'><fieldset id='CnY0d'></fieldset></dl></div>

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

                      <bdo id='CnY0d'></bdo><ul id='CnY0d'></ul>
                          <tfoot id='CnY0d'></tfoot>
                              <tbody id='CnY0d'></tbody>
                          • <legend id='CnY0d'><style id='CnY0d'><dir id='CnY0d'><q id='CnY0d'></q></dir></style></legend>

                            主站蜘蛛池模板: 高低温万能试验机_拉力试验机_拉伸试验机-馥勒仪器科技(上海)有限公司 | 引领中高档酒店加盟_含舍·美素酒店品牌官网 | 软文世界-软文推广-软文营销-新闻稿发布-一站式软文自助发稿平台 | 玉米深加工机械,玉米加工设备,玉米加工机械等玉米深加工设备制造商-河南成立粮油机械有限公司 | 光泽度计_测量显微镜_苏州压力仪_苏州扭力板手维修-苏州日升精密仪器有限公司 | 北京发电机出租_发电机租赁_北京发电机维修 - 河北腾伦发电机出租 | 斗式提升机,斗式提升机厂家-淄博宏建机械有限公司 | 蜂窝块状沸石分子筛-吸附脱硫分子筛-萍乡市捷龙环保科技有限公司 | 河南卓美创业科技有限公司-河南卓美防雷公司-防雷接地-防雷工程-重庆避雷针-避雷器-防雷检测-避雷带-避雷针-避雷塔、机房防雷、古建筑防雷等-山西防雷公司 | 广西资质代办_建筑资质代办_南宁资质代办理_新办、增项、升级-正明集团 | 屏蔽泵厂家,化工屏蔽泵_维修-淄博泵业 | 北京乾茂兴业科技发展有限公司 | 企业VI设计_LOGO设计公司_品牌商标设计_【北京美研】 | 电地暖-电采暖-发热膜-石墨烯电热膜品牌加盟-暖季地暖厂家 | 集菌仪_智能集菌仪_全封闭集菌仪_无菌检查集菌仪厂家-那艾 | 烘干设备-热泵烘干机_广东雄贵能源设备有限公司 | 黑龙江「京科脑康」医院-哈尔滨失眠医院_哈尔滨治疗抑郁症医院_哈尔滨精神心理医院 | 没斑啦-专业的祛斑美白嫩肤知识网站-去斑经验分享 | 发电机组|柴油发电机组-批发,上柴,玉柴,潍柴,康明斯柴油发电机厂家直销 | WTB5光栅尺-JIE WILL磁栅尺-B60数显表-常州中崴机电科技有限公司 | 【黄页88网】-B2B电子商务平台,b2b平台免费发布信息网 | 重庆小面培训_重庆小面技术培训学习班哪家好【终身免费复学】 | 顺辉瓷砖-大国品牌-中国顺辉| 磷酸肌酸二钠盐,肌酐磷酰氯-沾化欣瑞康生物科技 | 非标压力容器_碳钢储罐_不锈钢_搪玻璃反应釜厂家-山东首丰智能环保装备有限公司 | 120kv/2mA直流高压发生器-60kv/2mA-30kva/50kv工频耐压试验装置-旭明电工 | 无线讲解器-导游讲解器-自助讲解器-分区讲解系统 品牌生产厂家[鹰米讲解-合肥市徽马信息科技有限公司] | 硬齿面减速机_厂家-山东安吉富传动设备股份有限公司 | 深圳市源和塑胶电子有限公司-首页| 亿诺千企网-企业核心产品贸易| 西安烟道厂家_排气道厂家_包立管厂家「陕西西安」推荐西安天宇烟道 | 油冷式_微型_TDY电动滚筒_外装_外置式电动滚筒厂家-淄博秉泓机械有限公司 | 玉米深加工设备-玉米深加工机械-新型玉米工机械生产厂家-河南粮院机械制造有限公司 | 塑钢课桌椅、学生课桌椅、课桌椅厂家-学仕教育设备首页 | 创客匠人-让IP变现不走弯路| 公交驾校-北京公交驾校欢迎您! 工作心得_读书心得_学习心得_找心得体会范文就上学道文库 | 印刷人才网 印刷、包装、造纸,中国80%的印刷企业人才招聘选印刷人才网! | KBX-220倾斜开关|KBW-220P/L跑偏开关|拉绳开关|DHJY-I隔爆打滑开关|溜槽堵塞开关|欠速开关|声光报警器-山东卓信有限公司 | 自动气象站_农业气象站_超声波气象站_防爆气象站-山东万象环境科技有限公司 | 天津市能谱科技有限公司-专业的红外光谱仪_红外测油仪_紫外测油仪_红外制样附件_傅里叶红外光谱技术生产服务厂商 | 首页-瓜尔胶系列-化工单体系列-油田压裂助剂-瓜尔胶厂家-山东广浦生物科技有限公司 |