0
votes

We're using CakePHP 3.5.17 and would like to use the forum plugin from CakeDC: https://github.com/CakeDC/cakephp-forum

We installed it with Composer, and added this line in the app's bootstrap.php :

Plugin::load('CakeDC/Forum', ['bootstrap' => true, 'routes' => true]);

The plugin works and we are able to navigate through the routes, using the path : "/forum", like "mysite.com/forum".

But we'd need to use the plugin for a prefix (let's say "member"), and then, it doesn't work anymore. Navigating to "mysite.com/member/forum" throws an Missing Controller exception. CakePHP looks for a ForumController in the application, though it should look for the plugin...

We didn't write any particular routes for the prefix. Just declared it:

Router::prefix('member', function ($routes) {
    $routes->fallbacks(DashedRoute::class);
});

Are we missing someting? I thought CakePHP's default routes were able to manage routes using a "/:prefix/:plugin/:controller" structure (according to the doc).

Here is what CakePHP traces:

params => [
    'controller' => 'Forum',
    'pass' => [],
    'action' => 'index',
    'prefix' => 'member',
    'plugin' => null,
    '_matchedRoute' => '/member/:controller',
    '_ext' => null,
    'isAjax' => false
]
1
not sure if is the same issue but maybe this answer could help. - arilia

1 Answers

0
votes

What out could do is load Forum plugin without routes

Plugin::load('CakeDC/Forum', ['bootstrap' => true]);

And the copy content of Forum plugin routes.php file to your app routes.php, only replacing ['path' => '/forum'] with ['path' => '/member/forum'].