ZF-2429: Controller Module Bug
Description
I use Controller Module: article, blog and so on. but no default module. because I don't want to use default controller.
when I request a url like 'http://www.foobar.com/article/contents/add', I get some error messenge:
Notice: Undefined index: default in C:\web\zend\library\Zend\Controller\Dispatcher\Standard.php on line 330
I think that default module should be optional.
Comments
Posted by Michal Minicki (martel) on 2008-01-14T06:31:20.000+0000
If you don't use a "default" module, then you should point to a module that is default for you (the one you're accessing by root '/') because that's how the framework works at the moment. For instance:
But after looking at the code, I guess Dispatcher would be a good candidate for refactoring. The method which throws an error does too much in my opinion. It's name and signature - getControllerClass(Zend_Controller_Request_Abstract $request) - suggests it returns controller class using Request object. But in fact, it does a lot more (and shouldn't). It could return a class name mid way and what follows should be refactored into more appropriate places.
This shouldn't be happening there:
Matthew, I could give this class a revamp. Making sure it works as expected and passes all the unit tests. Everything I need is just a green light from you.
Posted by wangbo (wangbo) on 2008-01-14T19:14:29.000+0000
I have a question.
if I code: $dispatcher->setDefaultModule('blog');
then the controller name will be IndexController, not be Blog_IndexController
I think that above two names should be allowed for more consistency.
Posted by Matthew Weier O'Phinney (matthew) on 2008-01-29T12:42:38.000+0000
Duplicates ZF-1808.
Posted by Matthew Weier O'Phinney (matthew) on 2008-02-20T11:07:30.000+0000
Resolved in trunk. Passing the front controller or dispatcher parameter 'prefixDefaultModule' will ensure the controllers in the default module are namespaced.