Elegant way to switch database
Elegant way to switch database

Hi,
I am using Editor with PHP and now want to be able to dynamically change the database name
(all other connection information remain the same) after a login of the user.
I read that this is possible, i.e. by
Editor::inst( $this->editorDb, 'database.table', 'idfield' )
->field(
Field::inst( 'database.table.idfield' ),
but as I already have a large amount of such definitions I would like to use change once, i.e.
$this->editorDb->setDatabase('other_database');
Is this possible? Or do I really need to add the database to every single field in the code?
Thanks,
Pascal
Replies
Yes - if there are potential conflicts in name, you'd need to prefix the db name (if you are accessing multiple db's from the same instance) to each field.
Allan