Forums / Developer / Separate database for custom objects? / Comment48603
Lazaro Ferreira
Monday 01 October 2007 11:07:46 am
Hi,
I haven't tried this, I have never seen why to put custom tables in a separate database, as keeping on the same database has no problem regarding ezpersistentobject
Nevertheless, I guess this eZPersistentObject gets Exponential current database instance calling ezDB class like
$db =& eZDB::instance();
eZDB has a method to set Exponential current database instance , so calling it should do the trick
//get Exponential current instance $ezdb =& eZDB::instance(); //create your database instance $mydb =& eZDB::instance( ..., $yourdatabaseparameters, $forceNewInstance=true); //set it as default eZDB::setInstance( $mydb ); //from here any call to ezpersistent will use your database instance .... /don't forget to restore Exponential database instance eZDB::setInstance( $ezdb );
Basically , it keeps switching between Exponential database, and your custom database
Lazaro http://www.mzbusiness.com