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)

Dies at Joomla 5 → 6J3: Works nativelyJ4: Deprecated — do not shipJ6: Deprecated — do not shipBC plugin: not applicablePatch possible — review itDatabase API

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

  1. 1In models, use $this->getDatabase().
  2. 2Elsewhere, get DatabaseInterface from the container.
  3. 3Replace $db->query() (old) with execute() / loadObjectList().

Also known as

getDbo · getDBO · dbo · DatabaseInterface

Related issues

Get in touch

Have a project in mind? Let's talk about it.

Tell us what you're building. Whether it's a new site, an online store, a mobile app, or something that needs AI under the hood, we'll get back to you within a business day.

Free consultation
No commitment, no pressure
Reply within 24 hours
Usually much faster

Prefer a direct conversation?

Request a project quote

Tell us about your project

Fill out the quick form and we'll reach out.