diff --git a/system/database/Databases/Connectors/Oracle/ORDS/Model/Query.php b/system/database/Databases/Connectors/Oracle/ORDS/Model/Query.php index 35e9dd4..5079747 100644 --- a/system/database/Databases/Connectors/Oracle/ORDS/Model/Query.php +++ b/system/database/Databases/Connectors/Oracle/ORDS/Model/Query.php @@ -101,7 +101,6 @@ class Query implements QueryApi { if($resultSet) { $this->num_rows = $resultSet["count"]; - $this->items = $resultSet["items"]; } elseif (isset($resultEnd["result"])) { $this->num_rows = $resultEnd["result"]; diff --git a/system/engine/autoload.php b/system/engine/autoload.php index ef9f39c..d0fcd26 100644 --- a/system/engine/autoload.php +++ b/system/engine/autoload.php @@ -449,16 +449,21 @@ * @return bool */ private function loadModularFiles() { + if(self::isPhacil()) return false; + $modulesPrepared = array_map(function ($item) { return \Phacil\Framework\Registry::case_insensitive_pattern($item); }, self::$namespace); + $namespace = self::$namespace; + $tryMagicOne = \Phacil\Framework\Config::DIR_APP_MODULAR() . implode("/", $modulesPrepared) . ".php"; $files = glob($tryMagicOne, GLOB_NOSORT); try { if (!empty($files) && self::loadClassFile($files[0])) { + $this->checkModularDIs($modulesPrepared, $namespace); return true; } } catch (\Exception $e) { @@ -476,16 +481,21 @@ * @return bool */ private function loadModularWithoutNamespacesPrefix() { + if (self::isPhacil()) return false; + $modulesPrepared = array_map(function ($item) { return \Phacil\Framework\Registry::case_insensitive_pattern($item); }, self::$namespaceWithoutPrefix); + $namespace = self::$namespaceWithoutPrefix; + $tryMagicOne = \Phacil\Framework\Config::DIR_APP_MODULAR() . implode("/", $modulesPrepared) . ".php"; $files = glob($tryMagicOne, GLOB_NOSORT); try { if (!empty($files) && self::loadClassFile($files[0])) { + $this->checkModularDIs($modulesPrepared, $namespace); return true; } } catch (\Exception $e) { @@ -579,6 +589,36 @@ return in_array($class, $this->loadedClasses); } + /** + * Search for dynamic injectors + * @param array $modulesPrepared + * @param array $namespace + * @return void + * @throws \Phacil\Framework\Exception + */ + protected function checkModularDIs($modulesPrepared, $namespace) { + $files = []; + + if(count($modulesPrepared) > 2 && !\Phacil\Framework\Registry::isDIrouteChecked(implode("/", array_slice($namespace, 0, 2)))) { + $vendorModule = array_slice($modulesPrepared, 0, 2); + $tryMagicTwo = \Phacil\Framework\Config::DIR_APP_MODULAR() . implode("/", $vendorModule) . "/etc/preferences.json"; + $files = glob($tryMagicTwo, GLOB_NOSORT); + \Phacil\Framework\Registry::addDIrouteChecked(implode("/", array_slice($namespace, 0, 2))); + } + + if (!\Phacil\Framework\Registry::isDIrouteChecked(implode("/", array_slice($namespace, 0, 1)))) { + $vendorModule = array_slice($modulesPrepared, 0, 1); + $tryMagicOne = \Phacil\Framework\Config::DIR_APP_MODULAR() . implode("/", $vendorModule) . "/etc/preferences.json"; + + $files = is_array($files) && !empty($files) ? array_merge($files, glob($tryMagicOne, GLOB_NOSORT)) : glob($tryMagicOne, GLOB_NOSORT); + \Phacil\Framework\Registry::addDIrouteChecked(implode("/", array_slice($namespace, 0, 1))); + } + + foreach($files as $file){ + \Phacil\Framework\Registry::addPreference($file); + } + } + /** * Initite loaders process * diff --git a/system/engine/registry.php b/system/engine/registry.php index 3a30915..f226aa4 100644 --- a/system/engine/registry.php +++ b/system/engine/registry.php @@ -63,6 +63,8 @@ final class Registry { */ static private $preferences = []; + static private $diCheckedRoutes = []; + /** * Magic method to return engine instances * @@ -216,6 +218,7 @@ final class Registry { if($i >= count($routeArray)) break; $routeGlue = implode("/", array_slice($routeArray, 0, $i)); + self::addDIrouteChecked($routeGlue); $directory = \Phacil\Framework\Config::DIR_APP_MODULAR() . self::case_insensitive_pattern($routeGlue) . '/etc/preferences.json'; $files = glob($directory, GLOB_MARK); if(!empty($files)) break; @@ -231,6 +234,25 @@ final class Registry { } } + /** + * checks if a route has already had the DI checked + * @param string $route + * @return bool + */ + static public function isDIrouteChecked($route){ + return isset(self::$diCheckedRoutes[$route]); + } + + /** + * Add has check DI route + * @param string $route + * @return true + */ + static public function addDIrouteChecked($route){ + self::$diCheckedRoutes[$route] = true; + return self::$diCheckedRoutes[$route]; + } + /** * * @param string $for