MongoSession icon indicating copy to clipboard operation
MongoSession copied to clipboard

two db conecctions...

Open padreputativo opened this issue 11 years ago • 2 comments

I want to keep using this class but i dont want open two db sessions (with the password in two different files)... I want to use my own $db conection class, not to create a new conn (or need to change the entire script).... I think that must be optional....

padreputativo avatar Mar 01 '13 10:03 padreputativo

ops! i did not solved it yet...

padreputativo avatar Mar 01 '13 11:03 padreputativo

It shouldn't be all that bad to implement. Pass in a config param called connection containing the Mongo class. Check if $config['connection'] exists, and if so don't require them to specify a database. Next, do a verification on $config['connection'] to ensure it's of class Mongo. Later in _init(), don't perform $this->_connection = if you've already set $this->_connection and it's an instance of Mongo via !empty($this->_connection) && get_class($this->_connection) == 'Mongo'.

cballou avatar Mar 01 '13 12:03 cballou