From 879691d68d02a4648a6c4d660804b17885297bdf Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Fri, 1 Dec 2017 10:28:12 +0100 Subject: [PATCH] Fix install process --- DataStorage/Database/DataMapperAbstract.php | 2 +- Dispatcher/Dispatcher.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/DataStorage/Database/DataMapperAbstract.php b/DataStorage/Database/DataMapperAbstract.php index 7a8e4daee..0f09a5fe1 100644 --- a/DataStorage/Database/DataMapperAbstract.php +++ b/DataStorage/Database/DataMapperAbstract.php @@ -1494,7 +1494,7 @@ class DataMapperAbstract implements DataMapperInterface } $objects = $mapper::get($values); - $reflectionProperty->setValue($obj, !is_array($objects) ? [$objects] : $objects); + $reflectionProperty->setValue($obj, !is_array($objects) ? [$objects->getId() => $objects] : $objects); if (!$accessible) { $reflectionProperty->setAccessible(false); diff --git a/Dispatcher/Dispatcher.php b/Dispatcher/Dispatcher.php index fcf6aa262..9799a4e7c 100644 --- a/Dispatcher/Dispatcher.php +++ b/Dispatcher/Dispatcher.php @@ -107,6 +107,10 @@ class Dispatcher $views = []; $dispatch = explode(':', $controller); + if (!file_exists($path = __DIR__ . '/../../' . str_replace('\\', '/', $dispatch[0]) . '.php')) { + throw new PathException($path); + } + if (($c = count($dispatch)) === 3) { /* Handling static functions */ $function = $dispatch[0] . '::' . $dispatch[2]; @@ -170,10 +174,6 @@ class Dispatcher private function getController(string $controller) /* : object */ { if (!isset($this->controllers[$controller])) { - if (!file_exists($path = __DIR__ . '/../../' . str_replace('\\', '/', $controller) . '.php')) { - throw new PathException($path); - } - // If module controller use module manager for initialization if (strpos('\Modules\Controller', $controller) === 0) { $split = explode('\\', $controller);