Permalink
Browse files

allow loading namespaced classes

This permits, e.g.

App::uses('Ns\Foo', 'Plugin.Lib');
...
new Ns\Foo();
new \Ns\Foo(); // Or

to work
  • Loading branch information...
AD7six committed May 27, 2012
1 parent 4b8c469 commit 5bcb1346ab9101c9ef7e53cbb9c6a73105a5e1bb
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/Cake/Core/App.php
View
@@ -551,8 +551,10 @@ public static function load($className) {
$paths[] = $pluginPath . 'Lib' . DS . $package . DS;
$paths[] = $pluginPath . $package . DS;
}
+
+ $normalizedClassName = str_replace('\\', DS, $className);
foreach ($paths as $path) {
- $file = $path . $className . '.php';
+ $file = $path . $normalizedClassName . '.php';
if (file_exists($file)) {
self::_map($file, $className, $plugin);
return include $file;

0 comments on commit 5bcb134

Please sign in to comment.