Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libraries/src/Helper/TagsHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class TagsHelper extends CMSHelper
*/
public function addTagMapping($ucmId, TableInterface $table, $tags = [])
{
$db = $table->getDbo();
$db = $table->getDatabase();
Comment thread
Hackwar marked this conversation as resolved.
Outdated
$key = $table->getKeyName();
$item = $table->$key;
$query = $db->createQuery()
Expand Down
2 changes: 1 addition & 1 deletion libraries/src/Table/ContentType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}

Expand Down
2 changes: 1 addition & 1 deletion libraries/src/Table/MenuType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
75 changes: 5 additions & 70 deletions libraries/src/Table/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we not make a magic getter for another major?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've kept this around for a very long time, so I don't think extending the deprecation period further would be of any help.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


/**
* Should rows be tracked as ACL assets?
*
Expand Down Expand Up @@ -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
*
Expand Down Expand Up @@ -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();
}

/**
Expand Down
Loading