I'm sure I've missed something obvious, but I'm stumped.
I have a helper class located at:
administrator/components/com_supersite/src/Helper/supersite.php
<?php
\defined('_JEXEC') or die();
class Supersite {
I'm using a system plugin to register it as:
<?php
\defined('_JEXEC') or die;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\CMS\Log\Log;
class PlgSystemSupersite extends CMSPlugin
{
public function onAfterInitialise() {
Log::add('running onAfterInitialise in supersite plugin');
JLoader::registerPrefix('Supersite', JPATH_ADMINISTRATOR . '/components/com_supersite/src');
}
}
And then I try to do a very basic call to the class, pulling a json string to array:
<?php
namespace Joomla\Component\Supersite\Site\Controller;
use Joomla\CMS\MVC\Controller\BaseController;
use Supersite;
\defined('_JEXEC') or die;
class ajaxController extends BaseController
{
public function json()
{
$supersite = new Supersite();
$prices = $supersite->getData('products/customer-price.json');
echo json_decode($prices);
}
}
And the resulting error message:
{"error":true,"code":0,"message":"Class \"Supersite\" not found","trace":"#0 C:\\Users\\username\\OneDrive\\Documents\\Development\\xampp\\htdocs\\joomla\\libraries\\src\\MVC\\Controller\\BaseController.php(672): Joomla\\Component\\Supersite\\Site\\Controller\\ajaxController->json()\n#1 C:\\Users\\username\\OneDrive\\Documents\\Development\\xampp\\htdocs\\joomla\\libraries\\src\\Dispatcher\\ComponentDispatcher.php(143): Joomla\\CMS\\MVC\\Controller\\BaseController->execute('json')\n#2 C:\\Users\\username\\OneDrive\\Documents\\Development\\xampp\\htdocs\\joomla\\libraries\\src\\Component\\ComponentHelper.php(355): Joomla\\CMS\\Dispatcher\\ComponentDispatcher->dispatch()\n#3 C:\\Users\\username\\OneDrive\\Documents\\Development\\xampp\\htdocs\\joomla\\libraries\\src\\Application\\SiteApplication.php(200): Joomla\\CMS\\Component\\ComponentHelper::renderComponent('com_supersite')\n#4 C:\\Users\\username\\OneDrive\\Documents\\Development\\xampp\\htdocs\\joomla\\libraries\\src\\Application\\SiteApplication.php(241): Joomla\\CMS\\Application\\SiteApplication->dispatch()\n#5 C:\\Users\\username\\OneDrive\\Documents\\Development\\xampp\\htdocs\\joomla\\libraries\\src\\Application\\CMSApplication.php(294): Joomla\\CMS\\Application\\SiteApplication->doExecute()\n#6 C:\\Users\\username\\OneDrive\\Documents\\Development\\xampp\\htdocs\\joomla\\includes\\app.php(61): Joomla\\CMS\\Application\\CMSApplication->execute()\n#7 C:\\Users\\username\\OneDrive\\Documents\\Development\\xampp\\htdocs\\joomla\\index.php(32): require_once('C:\\\\Users\\\\username\\\\...')\n#8 {main}"}