I am developing a custom plugin in cake PHP 2.x, But I am not able to access it using it's routes

118 views Asked by At

I have created plugin using it's documentation written in Cookbook.

cake bake plugin Mytool

And it does fine created a plugin named Mytool inside the app plugin folder. Now created a controller using command.

cake bake controller Tests --plugin Mytool

It created a new controller inside the app plugin controller folder and then I created routes inside app plugin config routes.php file as

Router::connect('/testing', array('plugin' => 'recontool', 'controller' => 'tests', 'action' => 'index'));

Then I loaded this plugin using command

CakePlugin::load(['Recontool' => ['routes' => true]]);

Inside the app config bootstrap.php, and plugin loaded successfully. But when I am trying to access the routes of the plugin it does not work but only shows error of RecontoolController could not be found..

I have to do this in cake PHP version 2

1

There are 1 answers

0
Divyesh Prajapati On

In routes.php file; you are defining wrong routes. Your Plugin name and Controller name is not proper in your route.

This should be your correct route. If your plugin name is Mytool and controller name is TestsController.

Router::connect('/testing', array('plugin' => 'Mytool', 'controller' => 'Tests', 'action' => 'index'));