-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
[7.0] Remove deprecated getDbo()/setDbo() from Table class #47440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 7.0-dev
Are you sure you want to change the base?
Changes from 5 commits
f6b6ee5
649ab87
9998ab5
c706ecf
f0086e1
f097052
1f79caf
8473938
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we not make a magic getter for another major?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have something like https://github.com/joomla/joomla-cms/pull/45862/changes#r3274650060 in mind |
||
|
|
||
| /** | ||
| * 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(); | ||
| } | ||
|
|
||
| /** | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Load at least the database from the container
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The whole code actually needs to be refactored.