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
1 changed files with 5 additions and 1 deletions

View File

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