Skip to content
Permalink
Browse files

Removing uses of App::uses

  • Loading branch information...
jrbasso committed Sep 9, 2012
1 parent 74b6f1e commit 463cec7cd55116958642cb6bfd185178813f157b
@@ -16,7 +16,9 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
App::uses('Shell', 'Console');
namespace App\Console\Command;
use Cake\Console\Shell;
/**
* Application Shell
@@ -20,7 +20,9 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
App::uses('Helper', 'View');
namespace App\View\Helper;
use Cake\View\Helper;
/**
* Application helper
@@ -57,7 +57,6 @@ public function startup() {
foreach ($this->models as $model) {
$class = $model;
$this->models[$model] = $class;
App::uses($class, 'Model');
$this->{$class} = new $class();
}
$this->out(__d('cake_console', 'Model classes:'));
@@ -59,7 +59,7 @@ class TestTask extends BakeTask {
/**
* Mapping between packages, and their baseclass + package.
* This is used to generate App::uses() call to autoload base
* This is used to generate App::classname() call to autoload base
* classes if a developer has forgotten to do so.
*
* @var array
@@ -258,14 +258,8 @@ public function typeCanDetectFixtures($type) {
* @return boolean
*/
public function isLoadableClass($package, $class) {
App::uses($class, $package);
list($plugin, $ns) = pluginSplit($package);
if ($plugin) {
App::uses("{$plugin}AppController", $package);
App::uses("{$plugin}AppModel", $package);
App::uses("{$plugin}AppHelper", $package);
}
return class_exists($class);
$classname = App::classname($class, $package);
return !empty($classname);
}
/**
@@ -309,7 +303,7 @@ public function getRealClassName($type, $class) {
}
/**
* Map the types that TestTask uses to concrete types that App::uses can use.
* Map the types that TestTask uses to concrete types that App::classname can use.
*
* @param string $type The type of thing having a test generated.
* @param string $plugin The plugin name.
@@ -472,10 +472,7 @@ public static function objects($type, $path = null, $cache = true) {
}
/**
* Method to handle the automatic class loading. It will look for each class' package
* defined using App::uses() and with this information it will resolve the package name to a full path
* to load the class from. File name for each class should follow the class name. For instance,
* if a class is name `MyCustomClass` the file name should be `MyCustomClass.php`
* Method to handle the class loading manually, ie. Vendor classes.
*
* @param string $className the name of the class to load
* @return boolean
@@ -1529,10 +1529,10 @@ protected function _renderTemplates($content) {
return $rendered;
}
$viewClass = $this->_viewRender;
if ($viewClass !== 'View') {
list($plugin, $viewClass) = pluginSplit($viewClass, true);
$viewClass .= 'View';
App::uses($viewClass, $plugin . 'View');
if ($viewClass === 'View') {
$viewClass = App::classname('View', 'View');
} else {
$viewClass = App::classname($viewClass, 'View', 'View');
}
$View = new $viewClass(null);

0 comments on commit 463cec7

Please sign in to comment.
You can’t perform that action at this time.