I have a camelcased controller name called MenuItem. And Also I have created a router for this particular controller as
$routeMenuItem = new Zend_Controller_Router_Route('/menu-item/:action/:menu/:parent/:id/*', array(
'controller' => 'MenuItem',
'action' => 'index',
'menu' => 1,
'parent' => 0,
'id' => 0
));
No, when I navigate to this route lets say /menu-item/index/2
I get a error, Invalid controller specified (MenuItem)
error.
However I am encountering this problem while deploying under linux environment. But, during development in Windows environment it works fine.
How to solve this?
More Information
Controller:
File Name: MenuItemController.php
Class Name: MenuItemController
Stack Trace
#0 /../library/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#1 /../library/Zend/Application/Bootstrap/Bootstrap.php(97): Zend_Controller_Front->dispatch()
#2 /../library/Zend/Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#3 /../public/index.php(25): Zend_Application->run()
#4 {main}
Request Parameters
array (
'action' => 'index',
'menu' => '2',
'controller' => 'MenuItem',
'parent' => 0,
'id' => 0,
)
This is because Windows is not case sensitive and Linux based operating systems are.
From the ZendFramework manual:
This means that MenuItemController.php and MenuitemController.php are two different things, thus the autoloader is unable to find a match.
As a rule, when using multi word controllers just make sure that only the first letter of the class and the C in controller is capitalized.