Trembowiecki
Active Member
Hi,
regarding Joomla 5, when I want to connect to a local database, I can use:
1) $db = Joomla\CMS\Factory::getContainer()->get('DatabaseDriver');
$query = $db->createQuery();
or
2) $db = FabrikWorker::getDbo();
$query = $db->getQuery(true);
because
3) $db = JFactory::getDbo();
$query = $db->getQuery(true);
is deprecated, right? So... what's the status of 2)? Will it be deprecated too in near future, as 3) has been? To avoid that I switched to 1), BUT the problem is: with 2) I could easily connect to external database, I just had to add another connection to Fabrik and use:
$db = FabrikWorker::getDbo(false, 2);
$query = $db->getQuery(true);
I don't know how to do this with 1). So, in Joomla 5 what is the best way to connect to local and external databases?
regarding Joomla 5, when I want to connect to a local database, I can use:
1) $db = Joomla\CMS\Factory::getContainer()->get('DatabaseDriver');
$query = $db->createQuery();
or
2) $db = FabrikWorker::getDbo();
$query = $db->getQuery(true);
because
3) $db = JFactory::getDbo();
$query = $db->getQuery(true);
is deprecated, right? So... what's the status of 2)? Will it be deprecated too in near future, as 3) has been? To avoid that I switched to 1), BUT the problem is: with 2) I could easily connect to external database, I just had to add another connection to Fabrik and use:
$db = FabrikWorker::getDbo(false, 2);
$query = $db->getQuery(true);
I don't know how to do this with 1). So, in Joomla 5 what is the best way to connect to local and external databases?