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:
$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:
$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:
$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:
$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.