Feature RTC PR-5.4-dev Pending

User tests: Successful: 0 Unsuccessful: 0

avatar HLeithner
HLeithner
19 Mar 2025

PR fixes Issue in joomla-framework/database#326

Summary of Changes

Forward compatibility PR to use DatabaseAwareTrait which allows us to set a database driver which implements only the DatabaseInterface and does not need to extend the DatabaseDriver.

This pr introduces setDatabase() and getDatabase() in a b/c way until the _db variable and setDbo() and getDbo() gets removed.

@alexandreelise please test this pr for your use case and mark it as success if it fixes your issue.

Testing Instructions

Use Joomla, use any 3rd party extension which uses the Table class.

Actual result BEFORE applying this Pull Request

Works

Expected result AFTER applying this Pull Request

Works

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org: TBD

  • No documentation changes for manual.joomla.org needed

avatar HLeithner HLeithner - open - 19 Mar 2025
avatar HLeithner HLeithner - change - 19 Mar 2025
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 19 Mar 2025
Category Libraries
avatar alexandreelise
alexandreelise - comment - 19 Mar 2025

@HLeithner might be useful. Unfortunately I use my PR in production already. Cannot afford to wait for Joomla to catch up and wait for Joomla 5.4. Nice work keep on your good work.

avatar HLeithner
HLeithner - comment - 19 Mar 2025

You don't need to wait, just please test it.

avatar HLeithner HLeithner - change - 20 Mar 2025
Labels Added: PR-5.4-dev
avatar alexandreelise
alexandreelise - comment - 20 Mar 2025

You don't need to wait, just please test it.

Tested successfully

It works even with a driver different than the one of the main database.

In this case I tried mysql driver for the external database which is used for PDO Driver (but PDODriver is an abstract class) and the main joomla database untouched from your pr is using mysqli driver

Here is a screenshot of data fetched from external database using an Table instantiated via anonymous class with injected external DatabaseInterface compatible from DatabaseFactory getDriver method.

Screenshot from 2025-03-20 12-24-59

avatar alexandreelise
alexandreelise - comment - 20 Mar 2025

Hey @HLeithner #45165 (comment) Tested successfully. Enjoy your weekend Super Joomlers.

avatar fgsw
fgsw - comment - 20 Mar 2025

@alexandreelise Can you open https://issues.joomla.org/tracker/joomla-cms/45165 and

Login with your github-account and

  1. click button "Test this"
  2. mark "Tested successfully"
  3. click button "Submit test result".
test-pr-submit

Now the test count as successfull.

avatar alexandreelise alexandreelise - test_item - 20 Mar 2025 - Tested successfully
avatar alexandreelise
alexandreelise - comment - 20 Mar 2025

I have tested this item ✅ successfully on 0743884

Please refer to https://issues.joomla.org/tracker/joomla-cms/45165#event-815648


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45165.
avatar alexandreelise
alexandreelise - comment - 20 Mar 2025

Thanks @fgsw . Done. Enjoy your weekend.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45165.

avatar richard67
richard67 - comment - 22 Mar 2025

@alexandreelise The PR has received a change. Could you test again? Just a quick check if it still works would be sufficient. Thanks in advance.

avatar alexandreelise
alexandreelise - comment - 23 Mar 2025

@richard67 Tested it and seems to still work as expected if I didn't do a mistake will testing. For me it still works fine just as the previous screenshot I showed.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45165.

avatar joomdonation joomdonation - test_item - 23 Mar 2025 - Tested successfully
avatar joomdonation
joomdonation - comment - 23 Mar 2025

I have tested this item ✅ successfully on d91c66d


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45165.

avatar richard67
richard67 - comment - 23 Mar 2025

@alexandreelise Sorry to bother you again, but the PR has again received changes. But I think now it's ready. Could you test again with the latest version and if ok, submit your test result with the issue tracker? Thanks in advance.

avatar richard67 richard67 - alter_testresult - 23 Mar 2025 - joomdonation: Tested successfully
avatar alexandreelise alexandreelise - test_item - 23 Mar 2025 - Tested successfully
avatar alexandreelise
alexandreelise - comment - 23 Mar 2025

I have tested this item ✅ successfully on 6cdbf1b

@richard67 Still working as expected. Same outcome than before.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45165.

avatar alexandreelise alexandreelise - test_item - 23 Mar 2025 - Tested successfully
avatar alexandreelise
alexandreelise - comment - 23 Mar 2025

I have tested this item ✅ successfully on 6cdbf1b

@richard67 Still working as expected. Same outcome than before.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45165.

avatar alexandreelise
alexandreelise - comment - 23 Mar 2025

@richard67 Hey Richard, test done again with new changes. Seems to still work as expected. Same outcome. Tested successfully.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45165.

avatar richard67 richard67 - change - 23 Mar 2025
Status Pending Ready to Commit
avatar richard67
richard67 - comment - 23 Mar 2025

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45165.

avatar laoneo
laoneo - comment - 24 Mar 2025

When a developer does setup a database in the constructor and assigns it with "$this->_db" then we have a difference here which might lead to unintended divergence. This should be handled somehow, that's why I used magic methods in #37095.

avatar HLeithner
HLeithner - comment - 24 Mar 2025

When a developer does setup a database in the constructor and assigns it with "$this->_db" then we have a difference here which might lead to unintended divergence. This should be handled somehow, that's why I used magic methods in #37095.

That's the reason I don't use databaseAwareTraitDatabase write only. databaseAwareTraitDatabase also can't be read by any child class. It's only set for documentation purpose.

The reason I didn't use the magic function is, that if someone uses this on it's own, we would have the same issue again. Using the _db until we remove it, seems to be the better way for me.

avatar richard67 richard67 - change - 26 Mar 2025
Labels Added: Feature RTC
avatar richard67
richard67 - comment - 26 Mar 2025

@laoneo Are you ok with Harald's answer to your comment?

avatar laoneo
laoneo - comment - 26 Mar 2025

I guess this is fine here. The hard bc break comes, when $this->_db get removed.

Add a Comment

Login with GitHub to post a comment