diff --git a/src/Template/Error/missing_controller.ctp b/src/Template/Error/missing_controller.ctp index 4caa7a57e18..53cd4a3eb41 100644 --- a/src/Template/Error/missing_controller.ctp +++ b/src/Template/Error/missing_controller.ctp @@ -18,8 +18,11 @@ use Cake\Utility\Inflector; $pluginDot = empty($plugin) ? null : $plugin . '.'; $namespace = Configure::read('App.namespace'); -$prefixNs = ''; -$prefixPath = ''; +$prefixNs = $prefixPath = ''; + +$incompleteInflection = (strpos($class, '_') !== false || strpos($class, '-')); +$originalClass = $class; + $class = Inflector::camelize($class); if (!empty($prefix)) { @@ -42,33 +45,47 @@ $this->layout = 'dev_error'; $this->assign('title', 'Missing Controller'); $this->assign('templateName', 'missing_controller.ctp'); -$this->start('subheading'); ?> +start('subheading');?> Error: -Controller could not be found. -

- In the case you tried to access a plugin controller make sure you added it to your composer file or you use the autoload option for the plugin. -

+ + Your routing resulted in as a controller name. + + Controller could not be found. + end() ?> -start('file') ?> -

- Error: - Create the class Controller below in file: -

-start('file'); ?> + +

The controller name has not been properly inflected, and + could not be resolved to a controller that exists in your application.

-use {$namespace}\Controller\AppController; +

Ensure that your URL request->getUri()->getPath()) ?> is + using the same inflection style as your routes do. By default applications use DashedRoute + and URLs should use - to separate multi-word controller names.

+ +

+ In the case you tried to access a plugin controller make sure you added it to your composer file or you use the autoload option for the plugin. +

+

+ Error: + Create the class Controller below in file: +

-class {$class}Controller extends AppController -{ + -
-end() ?> + ?> +
+ +end(); ?>