allow loading namespaced classes

This permits, e.g.

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

to work
This commit is contained in:
AD7six 2012-05-27 19:18:14 +02:00
parent 4b8c469004
commit 5bcb1346ab

View file

@ -551,8 +551,10 @@ class App {
$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;