Hi
I got “Missing Controller” though the controller class seems to be found by Router and the controller exits.
When the url is /admin/stats/contenus, i want to reach the action=>contenus in the StatistiquesController.php in my plugin=>Statistics using prefix=>admin.
In Application::bootstrap
$this->addPlugin(‘Statistics’);
In my main project route.php:
$routes->prefix('admin', function (RouteBuilder $builder) {
.../...
/* Option 1 */
$builder->connect('/stats/*', ['plugin' => 'Statistics', 'controller' => 'Statistiques', 'prefix' => false]);
$builder->fallbacks(DashedRoute::class);
});
/* Option 2 */
$routes->prefix('/admin/stats', function (RouteBuilder $builder) {
$builder->connect('/*', ['plugin' => 'Statistics', 'controller' => 'Statistiques', 'prefix' => false]);
});
/* Option 3 */
$routes->scope('/admin', function (RouteBuilder $builder) {
$builder->connect('/stats/*', ['plugin' => 'Statistics', 'controller' => 'Statistiques', 'prefix' => false]);
});
In my plugins/Statistics/src/Controller/StatistiquesController.php
<?php
declare(strict_types=1);
namespace Statistics\Controller;
use Statistics\Controller\AppController;
class StatistiquesController extends AppController
{
public function contenus(): void
{
}
}
None of the options above work.
When I type following url “http://localhost:8765/admin/stats/contenus”
I get the following error:
Create the class StatistiquesController below in file: W:\WORK-CK4/plugins/Statistics/src\Controller\StatistiquesController.php
My controller exists in the location and has the right name.
What am I missing?
Thx for help.