Flourish PHP Unframework
This is an archived copy of the forum for reference purposes

Multiple Databases Problem

posted by nevermind89x 7 years ago

Hi im trying to use ORM multiple databases, but i cant get it to work.

In my config.php file i have:

//Default
$db = new fDatabase('mysql', 'dbname', 'user', 'pass');
fORMDatabase::attach($db);

//new instance
$db2 = new fDatabase('mysql', 'dbname_2', 'user_2', 'pass_2');
fORMDatabase::attach($db2, 'newdb');
fORM::mapClassToDatabase('User', 'newdb');

I have my class (user.php):

class User extends fActiveRecord { 
	protected function configure() {}
}

then when I try to use:

$user = new User();

It throws this error: Uncaught exception 'fProgrammerException' with message 'The table specified, users, does not exist in the database

Any help would be useful

Thanks

Ok i solved it, I was missing the mapClassToTable, thanks

posted by nevermind89x 7 years ago