Valc / jmlocalise

GNU General Public License v2.0
3 stars 2 forks source link

Class "JObject" not found #3

Open uzielweb opened 9 months ago

uzielweb commented 9 months ago

Joomla 5, PHP 8.2.10, MariaDb

After install this appears

_No more j3 languages need reformatting.

Please choose a location AND a language in the filters. An error has occurred.

0 Class "JObject" not found_ 

I will try to help and upload possible solution.

uzielweb commented 9 months ago

Solution

In Joomla 5, there have been some significant changes, and some classes and methods have been deprecated or replaced. To replace the use of \JObject, you should now use \Joomla\CMS\Object\CMSObject. I'll provide an example of how you can use this, including comments:

use Joomla\CMS\Object\CMSObject;

// Create a CMSObject
$myObject = new CMSObject();

// Set properties
$myObject->myProperty1 = 'Value of property 1';
$myObject->myProperty2 = 'Value of property 2';

// Access properties
echo $myObject->myProperty1; // This will print 'Value of property 1'
echo $myObject->myProperty2; // This will print 'Value of property 2'

Make sure to replace the previous code that uses \JObject with the new code that uses \Joomla\CMS\Object\CMSObject. This should resolve the compatibility issue with Joomla 5. Also, be sure to adjust other parts of your code as necessary to fit the changes introduced in Joomla 5.