Dispatching problem

Hi, i will try to explain my problem.

When dispatcher call dispatch method it execute two controller actions instead of one. First it execute correct action and after this it always execute defined notFound action. No output from notFound action is render. I found this then i put some database logging logic in my notFound action. With every request new records appear in my db table which is not expexted.

My code looks like this: ```php $d = new Dispatcher(); $d->setDI($di); $d->setControllerName($router->getControllerName()); $d->setActionName($router->getActionName()); $d->setParams($router->getParams());

$d->dispatch(); ``` Then i saw a problem here i tried to debug a lit with this code, but it goes right way, everything works fine: ```php $d = new Dispatcher(); $d->setDI($di); $d->setControllerName("login"); $d->setActionName("index"); $d->setParams(array());

$d->dispatch(); ``` So i try to do it this way, but this don't work: ```php $controller = $router->getControllerName(); $action = $router->getActionName(); $params = $router->getParams();

$d = new Dispatcher(); $d->setDI($di); $d->setControllerName($controller); $d->setActionName($action); $d->setParams($params);

$d->dispatch(); ``` Then i decide that router is the bad guy here and try this and expecting bad results: ```php $controller = $router->getControllerName(); $action = $router->getActionName(); $params = $router->getParams();

$d = new Dispatcher(); $d->setDI($di); $d->setControllerName("login"); $d->setActionName("index"); $d->setParams(array());

$d->dispatch(); ``` But everithing works fine. Please tell me what's going on and what am i doing wrong. Thanks.

How have you defined the notFound route?

I'm asking because I've noticed a phantom dispatch to index/index in my application, but I did not go very deep with it (no time at present). I've noticed that the first dispatch is the requested route with all data available (i.e. module and namespace) and the second, in my case, only has data for controller and action (index/index).

If I figure something out I will post back, but I'm curious if there is more people with this problem, or maybe the two of us have something misconfigured.



353

I found work around for this problem, set notFound method with wrong data (to redirect nowhere) and then set dispatcher event beforeException to redirect to 404... Probably we have the same problem here because if i do not setup my notFound method dispatcher redirect me (i think) to default route which is index/index by default...