Fixed bug where controller was not changed after a routerCallViewEvent

Router::defaultCallable did not change the controller in the view upon a change in the RouterCallViewEvent.
This has been remedied by adding a check and performing the change when that check results in a discrepency.
This commit is contained in:
Abel Hoogeveen 2020-05-12 13:10:50 +02:00
parent cd1e19e784
commit e30d4ad366

View File

@ -371,7 +371,11 @@ class Router
// Reset vars
$this->view = $event->view;
$this->controller = $event->controller;
if ($this->controller !== $event->controller)
{
$this->controller = $event->controller;
$this->view->setController($this->controller);
}
} catch (EventException $e) {
throw new RouterException("Could not load view. routerCallViewEvent threw exception: '".$e->getMessage()."'");
}