JFACTORY-GETDBO-001
JFactory::getDbo()
Factory::getDbo() / getDBO()
getDbo() is a service locator. Joomla wants the database from the DI container. Core has deferred the fatal removal toward Joomla 7, but a native Joomla 6 extension should not ship getDbo().
JFactory::getDbo() → $this->getDatabase() or Factory::getContainer()->get(DatabaseInterface::class)
What you will see
- Factory::getDbo() is deprecated
- Joomla\CMS\Factory::getDbo is deprecated
Symptoms people search
deprecation log filled with getDbo · database calls still using Factory
Replace this code
Swap JFactory::getDbo() for $this->getDatabase() or Factory::getContainer()->get(DatabaseInterface::class).
Joomla 3
Remove or stop calling this
$db = JFactory::getDbo();
$db = Factory::getDbo();Joomla 4 / 6
Use this instead
use Joomla\CMS\Factory;
use Joomla\Database\DatabaseInterface;
$db = Factory::getContainer()->get(DatabaseInterface::class);
// Inside a model: $db = $this->getDatabase();How to fix it
- 1In models, use $this->getDatabase().
- 2Elsewhere, get DatabaseInterface from the container.
- 3Replace $db->query() (old) with execute() / loadObjectList().
Also known as
getDbo · getDBO · dbo · DatabaseInterface
Related issues
- Joomla 3 → 4Joomla API
Factory::getUri()
JFactory::getUri() → Uri::getInstance()
- Joomla 3 → 4Joomla API
Factory::getXml() / JXMLElement
JFactory::getXML() → SimpleXMLElement
- Joomla 3 → 4Joomla API
Factory::getEditor()
JFactory::getEditor() → Editor::getInstance()
- Joomla 5 → 6Joomla API
Factory::getUser()
JFactory::getUser() → $app->getIdentity() or UserFactoryInterface
- Joomla 5 → 6Joomla API
Factory::getSession()
JFactory::getSession() → $app->getSession()
- Joomla 4 → 5Joomla API
Factory::getMailer()
JFactory::getMailer() → Mailer from the container