Joomla\CMS\Factory::getDbo() is deprecated

RobertG

Member
Hi,

Could someone help me to understand this message I see on the frontend (debug on, reeor reporting to maximum, PHP 8.1.18). Sorry, comments are in French.
Une erreur s'est produite avec un champ évalué - veuillez en informer le propriétaire du site web.
Debug:
Eval exception : access_token (id 311)::_getV() : $myDb = JFactory::getDbo();
/* on cherche tant que la valeur est trouvée dans la table */
$count = 1;
while ($count > 0) {
/*calcul de l'identifiant sur 10 caractères alphanumériques sans lettre O ni chiffre zéro, mis dans la variable $string */
$string = "";
$chaine = "abcdefghijklmnpqrstuvwxy123456789ABCDEFGHIJKLMNPQRSTUVWXYZ"; srand((double)microtime()*1000000); for($i=0; $igetQuery(true) ->select('COUNT(*)') ->from($myDb->quoteName('hr5i3_fb_stay')) ->where($myDb->quoteName('access_token') . " = " . $myDb->quote($string));
// Reset the query using our newly populated query object.
$myDb->setQuery($query);
$count = $myDb->loadResult(); }
/* si aucun enregistrement avec ce code, on le conserve pour utilisation ultérieur */
return $string;
: Joomla\CMS\Factory::getDbo() is deprecated. Load the database from the dependency injection container.
Somewhere in a form (58 fields) I try to create an "access_token" and verify if another one has the same string in the table ""#__fb_stay". It seems it's the reason of this error.
I have no error in the J3 version.

Is it a way to find the field where is the PHP code to change? Or need I to edit each field?

This site was created 3 years ago, abandonned then new tests were made last year, so I don't remember (and I'm an old guy ;)).

Thanks for your help!
 
I found the calculation script in the element 311 and changed getDbo,
Code:
/*$myDb = JFactory::getDbo();*/
$myDb = Joomla\CMS\Factory::getContainer()->get('DatabaseDriver');
 
Last edited:
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top