当前位置:网站首页>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边栏推荐
- L'effet de l'oie sauvage sur l'économie numérique verte de Guilin
- The latest hbuilderx editing uni app project runs in the night God simulator
- 2021.11.3-7 scientific research log
- 二、八、十、十六进制相互转换
- Process terminated
- Support vector machine (SVM)
- 解决上传SFTPorg.apache.commons.net.MalformedServerReplyException: Could not parse respon
- Chapter V - message authentication and digital signature
- 移动端、安卓、IOS兼容性面试题
- Rich dad, poor dad Abstract
猜你喜欢

What is a good recommendation system?

Leverage contextual information

Summary of machine learning + pattern recognition learning (V) -- Integrated Learning

Voice assistant -- Qu -- query error correction and rewriting

Voice assistant - DM - distribution and sorting

Logistic regression

Summary of machine learning + pattern recognition learning (IV) -- decision tree

Voice assistant - Introduction and interaction process

Voice assistant - those classification models used in the assistant

Knife4j first use
随机推荐
20220526 损失函数
Parameter estimation of Weibull distribution
R语言glm函数构建泊松回归模型(possion)、epiDisplay包的poisgof函数对拟合的泊松回归模型进行拟合优度检验、即模型拟合的效果、验证模型是否有过度离散overdispersion
[redistemplate method details]
LeetCode笔记:Biweekly Contest 79
BI技巧丨当月期初
Arrangement of statistical learning knowledge points -- maximum likelihood estimation (MLE) and maximum a posteriori probability (map)
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
R language uses rstudio to save visualization results as PDF files (export--save as PDF)
2021.10.26 scientific research log
Fcpx plug-in: simple line outgoing text title introduction animation call outs with photo placeholders for fcpx
vscode 1.68变化与关注点(整理导入语句/实验性新命令中心等)
Modelarts training task 1
‘CMRESHandler‘ object has no attribute ‘_ timer‘,socket. gaierror: [Errno 8] nodename nor servname pro
Right click the general solution of file rotation jam, refresh, white screen, flash back and desktop crash
Rich dad, poor dad Abstract
20220524 backbone深度学习网络骨架
Utilize user behavior data
The computer is connected to WiFi but can't connect to the Internet
The R language catools package divides the data, the scale function scales the data, the KNN function of the class package constructs a k-nearest neighbor classifier, and compares the model accuracy u
