tags:

views:

30

answers:

1

I have lots of databases to hit and put in one page. Most of the frameworks only allow me two native configure them for one database. They all assume the usage is for a new app and one database. I have lots of legacy databases.

Since I can only configure one database in frameworks I have seen ci, zend, others, it looks like my additional db connections have to take place in my controller.

What could I code on the back end to keep them out of the controller. I don't want to have to put in connection=myconn, etc. in each controller for each disparate database.

Also, are there any frameworks that allow for multiple databases in the ORM mapping?

A: 

I separate my controllers from my database with events. I fire some abstract "SaveWhateverComplicatedData" event from my controller, and a different class (who knows about all of my data storage specifics) listens for those events and interprets them. It's working quite well for me, and, though I only have one DB, I don't see any reason I couldn't have more.

This is a custom framework I've set up myself, but you could hook into another framework by wrapping these "data events" up in an interface that looks like a database. You could implement whatever interface your framework needs WITH the data events, and still have your listening multiple-database class doing the real work.

Riley