In this project I'm working on I want to strictly control which routes are
valid for the application. At the moment, I have three controllers:
IndexController, ClientController, and ErrorController. I've set up 3
routes, like so:

<?php

$router->addRoute( 'client_list', new Zend_Controller_Router_Route(
'clients', [snipped] ) );
$router->addRoute( 'client_view', new Zend_Controller_Router_Route(
'client/:id', [snipped] ) );
$router->addRoute( 'client_edit', new Zend_Controller_Router_Route(
'client/:id/edit', [snipped] ) );

?>

I also set the router with the front controller's setRouter() method. With
the above setup, I can navigate to example.com/fake/ and will get the
expected, and custom, error message.

However, if I remove the default routes...

<?php

$router->removeDefaultRoutes();
$router->addRoute( 'client_list', new Zend_Controller_Router_Route(
'clients', [snipped] ) );
$router->addRoute( 'client_view', new Zend_Controller_Router_Route(
'client/:id', [snipped] ) );
$router->addRoute( 'client_edit', new Zend_Controller_Router_Route(
'client/:id/edit', [snipped] ) );

?>

...navigating to example.com/fake/ no longer invokes the expected error
message, but instead invokes the "index" action of IndexController.

Is this a bug, or am I missing something?

Thanks,
Ryan Lange

Reply via email to