CodeIgniter Forums
How to stop setPrefix() ? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: How to stop setPrefix() ? (/showthread.php?tid=78709)



How to stop setPrefix() ? - mylastof - 02-28-2021

The DBprefix has been set on ".env"
how to set DBprefix just once?
in one method/function I have
the following code:

Code:
$db->setPrefix('');
$table = $db->prefixTable('oldtable');

$builder = $db->table($table);
// get from oldtable with no prefix


// now I want to use model (UserModel) ...
// the prefix is set by .env, but now replace by setPrefix() above.
$userMeta = new UserMeta();
$metaBuilder = $userMeta->builder();
//