From: Roland Haeder Date: Fri, 24 Feb 2017 20:23:05 +0000 (+0100) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=021618e8e583e2101b2393c21e7d74f509479ddc;p=core.git Continued: - scanApplicationClasses() must be called before starter.php is being included. - this whole thing is old and needs an entire rewrite (which will take place slowly while this "namespace rewrite" and much more after it. - added "import" for BaseResolver and Resolver Signed-off-by: Roland Häder --- diff --git a/application/tests/init.php b/application/tests/init.php index 4c6879c6..b877adab 100644 --- a/application/tests/init.php +++ b/application/tests/init.php @@ -1,13 +1,11 @@ * @version 0.0 * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team @@ -27,5 +25,8 @@ use CoreFramework\Configuration\FrameworkConfiguration; * along with this program. If not, see . */ +// Scan for application's classes, exceptions and interfaces +ClassLoader::scanApplicationClasses(); + // Get config instance $cfg = FrameworkConfiguration::getSelfInstance(); diff --git a/inc/loader/class_ClassLoader.php b/inc/loader/class_ClassLoader.php index 95e26bb1..eee9fce1 100644 --- a/inc/loader/class_ClassLoader.php +++ b/inc/loader/class_ClassLoader.php @@ -190,11 +190,17 @@ class ClassLoader { * @return void */ public static function scanFrameworkClasses () { + // Trace message + /* NOISY-DEBUG: */ printf('[%s:%d]: CALLED!' . PHP_EOL, __METHOD__, __LINE__); + // Cache loader instance $loaderInstance = self::getSelfInstance(); // Load all classes foreach (self::$frameworkPaths as $pathName) { + // Debug message + /* NOISY-DEBUG: */ printf('[%s:%d]: pathName=%s' . PHP_EOL, __METHOD__, __LINE__, $pathName); + // Try to load the framework classes $loaderInstance->scanClassPath('inc/main/' . $pathName . '/'); } // END - foreach @@ -206,18 +212,24 @@ class ClassLoader { * @return void */ public static function scanApplicationClasses () { + // Trace message + /* NOISY-DEBUG: */ printf('[%s:%d]: CALLED!' . PHP_EOL, __METHOD__, __LINE__); + // Get config instance $cfg = FrameworkConfiguration::getSelfInstance(); // Load all classes for the application foreach (self::$frameworkPaths as $class) { // Create path name - $path = sprintf('%s/%s/%s', $cfg->getConfigEntry('application_path'), $cfg->getConfigEntry('app_name'), $class); + $pathName = sprintf('%s/%s/%s', $cfg->getConfigEntry('application_path'), $cfg->getConfigEntry('app_name'), $class); + + // Debug message + /* NOISY-DEBUG: */ printf('[%s:%d]: pathName=%s' . PHP_EOL, __METHOD__, __LINE__, $pathName); // Is the path readable? - if (is_dir($path)) { + if (is_dir($pathName)) { // Try to load the application classes - ClassLoader::getSelfInstance()->scanClassPath($path); + ClassLoader::getSelfInstance()->scanClassPath($pathName); } // END - if } // END - foreach } diff --git a/inc/main/classes/resolver/action/class_BaseActionResolver.php b/inc/main/classes/resolver/action/class_BaseActionResolver.php index cd6cd5e9..0c4841b6 100644 --- a/inc/main/classes/resolver/action/class_BaseActionResolver.php +++ b/inc/main/classes/resolver/action/class_BaseActionResolver.php @@ -4,6 +4,7 @@ namespace CoreFramework\Resolver\Action; // Import framework stuff use CoreFramework\Factory\ObjectFactory; +use CoreFramework\Resolver\BaseResolver; /** * A generic action resolver class diff --git a/inc/main/classes/resolver/command/class_BaseCommandResolver.php b/inc/main/classes/resolver/command/class_BaseCommandResolver.php index e538a8c4..730e2822 100644 --- a/inc/main/classes/resolver/command/class_BaseCommandResolver.php +++ b/inc/main/classes/resolver/command/class_BaseCommandResolver.php @@ -5,6 +5,7 @@ namespace CoreFramework\Resolver\Controller; // Import framework stuff use CoreFramework\Factory\ObjectFactory; use CoreFramework\Request\Requestable; +use CoreFramework\Resolver\BaseResolver; /** * A generic command resolver class diff --git a/inc/main/classes/resolver/controller/class_BaseControllerResolver.php b/inc/main/classes/resolver/controller/class_BaseControllerResolver.php index 38b81240..13a086a8 100644 --- a/inc/main/classes/resolver/controller/class_BaseControllerResolver.php +++ b/inc/main/classes/resolver/controller/class_BaseControllerResolver.php @@ -4,6 +4,7 @@ namespace CoreFramework\Resolver\Controller; // Import framework stuff use CoreFramework\Factory\ObjectFactory; +use CoreFramework\Resolver\BaseResolver; /** * A generic controller resolver class diff --git a/inc/main/interfaces/resolver/actions/class_ActionResolver.php b/inc/main/interfaces/resolver/actions/class_ActionResolver.php index 7cfdccfa..ec97b79a 100644 --- a/inc/main/interfaces/resolver/actions/class_ActionResolver.php +++ b/inc/main/interfaces/resolver/actions/class_ActionResolver.php @@ -4,6 +4,7 @@ namespace CoreFramework\Resolver\Action; // Import framework stuff use CoreFramework\Request\Requestable; +use CoreFramework\Resolver\Generic\Resolver; /** * An instance for action resolver classes diff --git a/inc/main/interfaces/resolver/class_Resolver.php b/inc/main/interfaces/resolver/class_Resolver.php index e06bdd43..437bbb86 100644 --- a/inc/main/interfaces/resolver/class_Resolver.php +++ b/inc/main/interfaces/resolver/class_Resolver.php @@ -1,6 +1,6 @@