rradutzu/zend2-doctrine-dynamic-db 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

rradutzu/zend2-doctrine-dynamic-db

Composer 安装命令:

composer require rradutzu/zend2-doctrine-dynamic-db

包简介

Zend2/3 Doctrine Module that allows defining connections using dynamic database names

README 文档

README

Zend2 Doctrine Module that allows defining connections using dynamic database names

#Usage

  1. Include 'DoctrineDynamicDb' in your modules.config.php file
  1. Add to the used connection the 'dbNameFactory' param.:
return array(
    //...
    'doctrine' => array(
        'connection' => array(
            //...
            'orm_dynamic' => array(
                'driverClass' => 'Doctrine\DBAL\Driver\PDOMySql\Driver',
                    'params' => array(
                    'host'     => 'localhost',
                    'port'     => '3306',
                    'user'     => 'root',
                    'password' => 'kotor3',
                    'dbname'   => '%',

                    // this needs to return instance of DoctrineMultiDbAdapter\Client\ClientInterface,
                    // a custom object or a string which represents the db name
                    'dbNameFactory' => 'ClientFactory',
                    // optional | name of the method used to retrieve the db name if dbNameFactory
                    // returns a custom object
                    'dbNameFactoryMethod' => 'getClientDb'
                )
            )
        ),
        'dynamic_entitymanager' => array(
            // need to add the connection to the new entity manager
            'orm_dynamic' => array()
        )
    ),
    //...
);

3.Get the entity manager for the dynamic connection using:

$em = $serviceLocator->get('doctrine.dynamic_entitymanager.##connection_name##');

统计信息

  • 总下载量: 16.02k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0
  • 更新时间: 2015-12-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固