Updating deprecated $db = JFactory::getDbo(); J4 / F4

ontarget

Active Member
I have a bunch of Calc elements using Ajax Calc on J!4.2.7 and F4BetaB
When i update the deprecated:
PHP:
$db = JFactory::getDbo();

to
PHP:
use Joomla\\CMS\\Factory;
use Joomla\\Database\\DatabaseInterface;
$db = Factory::getContainer()->get(DatabaseInterface::class);

The ajax calc stops working.
Is it ok to keep using the old method in Fabrik 4 or is there a better way of referencing the database that allows ajax calc to work? @troester seems to have it working (see post below) but it doesn't work for me, the calc element stays the same when other field values are changed.

https://github.com/joomlahenk/fabrik/issues/601#issuecomment-1365093932
 
As it is only a deprecated warning you can keep the old code.

To fix the ajax calc for code with \\ you can modify plugins/fabrik_element/calc/calc.php line 510
$cal = stripslashes($w->parseMessageForPlaceHolder($calc, $d));
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top