I'm building a simple component in Joomla 4, and after reading through some tutorials I feel like I've got it right - but I'm getting this error that I can't explain in the admin view
An error has occurred.
0 Invalid controller class: display
With logging enabled, this is what I see in everything.php:
#Fields: datetime priority clientip category message
2022-11-18T17:52:12+00:00 CRITICAL ::1 error Uncaught Throwable of type InvalidArgumentException thrown with message "Invalid controller class: display". Stack trace: #0 [ROOT]\libraries\src\Dispatcher\ComponentDispatcher.php(142): Joomla\CMS\Dispatcher\ComponentDispatcher->getController('display', 'Administrator', Array)
#1 [ROOT]\libraries\src\Component\ComponentHelper.php(355): Joomla\CMS\Dispatcher\ComponentDispatcher->dispatch()
#2 [ROOT]\libraries\src\Application\AdministratorApplication.php(143): Joomla\CMS\Component\ComponentHelper::renderComponent('com_testcomponent')
#3 [ROOT]\libraries\src\Application\AdministratorApplication.php(186): Joomla\CMS\Application\AdministratorApplication->dispatch()
#4 [ROOT]\libraries\src\Application\CMSApplication.php(294): Joomla\CMS\Application\AdministratorApplication->doExecute()
#5 [ROOT]\administrator\includes\app.php(61): Joomla\CMS\Application\CMSApplication->execute()
#6 [ROOT]\administrator\index.php(32): require_once('F:\\xampp\\htdocs...')
#7 {main}
My DisplayController.php file is at:
joomla\administrator\components\com_testcomponent\src\Controller\DisplayController.php
<?php
namespace Joomla\Component\Testcomponent\Administrator\Controller;
use Joomla\CMS\MVC\Controller\BaseController;
\defined('_JEXEC') or die;
class DisplayController extends BaseController
{
protected $default_view = 'orders';
}
services/provider.php
). And the<namespace>
tag of the XML manifest.