0

I have seen the earlier question on this subject and tried the suggested code:

$db = (new Joomla\Database\DatabaseFactory)->getDriver('mysqli', $options);

but get an error:

An error has occurred with a eval'd field - please inform the web-site owner. Debug: Caught exception on eval of ElementName: Database is not available in constructor in 5.0.

I also tried:

$db = DatabaseFactory::getDriver('mysqli', $options);

which gave the error:

Non-static method Joomla\Database\DatabaseFactory::getDriver() cannot be called statically

How should this be done?

2
  • This looks like a Fabrik error. The first piece of code works in normal J4. Jan 22, 2023 at 2:21
  • Thanks for this. I have now persevered and found that the problem only occurs with eval’d code; elsewhere, Fabrik is fine with it, so I have a workaround. Fabrik4 is only in beta at the moment, so problems are not entirely unexpected. Jan 24, 2023 at 14:58

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.