diff --git a/libraries/src/Helper/TagsHelper.php b/libraries/src/Helper/TagsHelper.php index d461b60ddf266..591bf04416e0e 100644 --- a/libraries/src/Helper/TagsHelper.php +++ b/libraries/src/Helper/TagsHelper.php @@ -98,7 +98,7 @@ class TagsHelper extends CMSHelper */ public function addTagMapping($ucmId, TableInterface $table, $tags = []) { - $db = $table->getDbo(); + $db = Factory::getDbo(); $key = $table->getKeyName(); $item = $table->$key; $query = $db->createQuery() diff --git a/libraries/src/Table/ContentType.php b/libraries/src/Table/ContentType.php index 7ec7f84ad5f2c..6ff2e535a3bb6 100644 --- a/libraries/src/Table/ContentType.php +++ b/libraries/src/Table/ContentType.php @@ -162,7 +162,7 @@ public function getContentTable() throw new \RuntimeException('Class must be an instance of Joomla\\CMS\\Table\\TableInterface'); } - $result = new $class($this->getDbo()); + $result = new $class($this->getDatabase()); } } diff --git a/libraries/src/Table/MenuType.php b/libraries/src/Table/MenuType.php index f57c196b99eda..18c0a728f581b 100644 --- a/libraries/src/Table/MenuType.php +++ b/libraries/src/Table/MenuType.php @@ -313,7 +313,7 @@ protected function _getAssetTitle() protected function _getAssetParentId(?Table $table = null, $id = null) { $assetId = null; - $asset = new Asset($this->getDbo()); + $asset = new Asset($this->getDatabase()); if ($asset->loadByName('com_menus')) { $assetId = $asset->id; diff --git a/libraries/src/Table/Table.php b/libraries/src/Table/Table.php index c3864603ad58d..30420bb32f7ce 100644 --- a/libraries/src/Table/Table.php +++ b/libraries/src/Table/Table.php @@ -19,8 +19,7 @@ use Joomla\Database\DatabaseAwareInterface; use Joomla\Database\DatabaseAwareTrait; use Joomla\Database\DatabaseInterface; -use Joomla\Database\DatabaseQuery; -use Joomla\Database\Exception\DatabaseNotFoundException; +use Joomla\Database\QueryInterface; use Joomla\Event\DispatcherAwareInterface; use Joomla\Event\DispatcherAwareTrait; use Joomla\Event\DispatcherInterface; @@ -86,18 +85,6 @@ abstract class Table extends \stdClass implements TableInterface, DispatcherAwar */ protected $_tbl_keys = []; - /** - * DatabaseInterface object. - * - * @var DatabaseInterface - * @since 1.7.0 - * - * @deprecated 5.4.0 will be removed in 7.0 - * Use setDatabase() and getDatabase() instead - * Example: $this->setDatabase($db); - */ - protected $_db; - /** * Should rows be tracked as ACL assets? * @@ -456,8 +443,8 @@ protected function _getAssetParentId(?Table $table = null, $id = null) /** * Method to append the primary keys for this table to a query. * - * @param DatabaseQuery $query A query object to append. - * @param mixed $pk Optional primary key parameter. + * @param QueryInterface $query A query object to append. + * @param mixed $pk Optional primary key parameter. * * @return void * @@ -542,65 +529,13 @@ public function getId() * * @since 1.7.0 * - * @deprecated 5.4.0 will be removed in 7.0 + * @deprecated 5.4.0 will be removed in 8.0 * Use getDatabase() instead * Example: $this->getDatabase(); */ public function getDbo() { - return $this->_db; - } - - /** - * Method to set the DatabaseInterface object. - * - * @param DatabaseInterface $db A DatabaseInterface object to be used by the table object. - * - * @return boolean True on success. - * - * @since 1.7.0 - * - * @deprecated 5.4.0 will be removed in 7.0 - * Use setDatabase() instead - * Example: $this->setDatabase($db); - */ - public function setDbo(DatabaseInterface $db) - { - $this->_db = $db; - - return true; - } - - /** - * Get the database. - * - * @return DatabaseInterface - * - * @since 5.4.0 - * @throws DatabaseNotFoundException May be thrown if the database has not been set. - * - * @note This method will be removed in 7.0 and DatabaseAwareTrait will be used instead. - */ - protected function getDatabase(): DatabaseInterface - { - return $this->getDbo(); - } - - /** - * Set the database. - * - * @param DatabaseInterface $db The database. - * - * @return void - * - * @since 5.4.0 - * - * @note This method will be removed in 7.0 and DatabaseAwareTrait will be used instead. - */ - public function setDatabase(DatabaseInterface $db): void - { - $this->_db = $db; - $this->databaseAwareTraitDatabase = $db; + return $this->getDatabase(); } /** diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 807c849722e07..937725c0e346c 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -11560,7 +11560,7 @@ parameters: Factory\:\:getContainer\(\)\-\>get\(DatabaseInterface\:\:class\);$# ''' identifier: staticMethod.deprecated - count: 13 + count: 14 path: libraries/src/Helper/TagsHelper.php -