当前位置:网站首页>Symfony 2: multiple and dynamic database connections
Symfony 2: multiple and dynamic database connections
2022-06-12 07:51:00 【Rich in starch】
problem :
I am quite new to SF2 and I was wondering how I could manage connections to severals databases into ONE bundle. I am a SF2 novice , I want to know how to manage several databases to ONE Bundled connections .For the moment I have this solution - which works fine - but I don't know if it is the right way to do it.... At present, I have this solution - Work well - But I don't know if this is the right way ....
in myBundle\\Ressource\\config\\config.yml : stay myBundle \\ Ressource \\ config \\ config.yml in :
doctrine:dbal: default_connection: default connections: default: dbname: SERVER user: root password: null host: localhost client: dbname: CLIENT_134 user: root password: null host: localhostorm: default_entity_manager: default entity_managers: default: connection: default mappings: MyBundle: ~ client: connection: client mappings: MyBundle: ~And then, in order to switch to one of the BD or the other, I do : then , To switch to BD Or one of them , Be me :
$O_ressource= $this->get('doctrine')->getEntityManager('client');$O_ressource= $this->get('doctrine')->getEntityManager('default');So guys, do you think it is a good way to manage this? So, guys , Do you think this is a good way to manage this ?
And my second question is : My second question is :
how to set up dynamic database connection? How to set up dynamic database connection ?I mean I have 100 databases in my system and I can't set all them in my config.yml file. I mean, my system has 100 A database , I can't be in config.yml Set them in the file .So I would like to be able to change database on the fly. So I want to be able to dynamically change the database .
Thanks for the help! Thank you for your help !
Solution :
Reference resources : https://stackoom.com/en/question/QtJf边栏推荐
- 移动端、安卓、IOS兼容性面试题
- Arrangement of statistical learning knowledge points gradient descent, least square method, Newton method
- Numerical calculation method chapter6 Iterative method for solving linear equations
- 2021.10.27-28 scientific research log
- vscode 1.68变化与关注点(整理导入语句/实验性新命令中心等)
- R语言rnorm函数生成正太分布数据、使用epiDisplay包的summ函数计算向量数据的描述性统计汇总信息并可视化有序点图(名称、有效值个数、均值、中位数、标准差、最大值、最小值)
- Dynamic simulation method of security class using Matlab based Matpower toolbox
- 20220524 backbone深度学习网络骨架
- Visual studio code batch comment and uncomment
- 20220607. 人脸识别
猜你喜欢

Vscode 1.68 changes and concerns (sorting and importing statements / experimental new command center, etc.)

What is a good recommendation system?

Chapter 2 - cyber threats and attacks

Topic 1 Single_ Cell_ analysis(2)

谋新局、促发展,桂林绿色数字经济的头雁效应

二、八、十、十六进制相互转换

Modelarts training task 1

BI技巧丨当月期初

经典论文回顾:Palette-based Photo Recoloring

2022r2 mobile pressure vessel filling test question simulation test platform operation
随机推荐
2021.10.26 scientific research log
AI fanaticism | come to this conference and work together on the new tools of AI!
Voice assistant -- Architecture and design of Instruction Assistant
『Three.js』辅助坐标轴
Interview computer network - transport layer
Topic 1 Single_Cell_analysis(2)
Modelants II
Conda创建虚拟环境报错,问题解决
謀新局、促發展,桂林綠色數字經濟的頭雁效應
20220524 backbone deep learning network framework
R语言dplyr包mutate_at函数和one_of函数将dataframe数据中指定数据列(通过向量指定)的数据类型转化为因子类型
2、 Eight, ten and hexadecimal conversion
20220525 RCNN--->Faster RCNN
Cold start problem of recommended system
2021.11.3-7 scientific research log
R语言使用RStudio将可视化结果保存为pdf文件(export--Save as PDF)
Chapter V - message authentication and digital signature
Bi skills - beginning of the month
R language uses the sum function of epidisplay package to calculate the descriptive statistical summary information of the specified variables in dataframe under different grouping variables, visualiz
Topic 1 Single_ Cell_ analysis(4)
