fixing up some App::import calls

This commit is contained in:
gwoo 2009-07-30 15:01:22 -07:00
parent 1423b0067b
commit 01d22ffd2e
8 changed files with 15 additions and 16 deletions

View file

@ -157,7 +157,7 @@ class BakeShell extends Shell {
$object = new $model();
$modelExists = true;
} else {
App::import('Model');
App::import('Model', 'Model', false);
$object = new Model(array('name' => $name, 'ds' => $this->connection));
}

View file

@ -27,7 +27,7 @@
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
App::import('File');
App::import('Model', 'CakeSchema');
App::import('Model', 'CakeSchema', false);
/**
* Schema is a command-line database management utility for automating programmer chores.

View file

@ -74,7 +74,7 @@ class FixtureTask extends Shell {
parent::__construct($dispatch);
$this->path = $this->params['working'] . DS . 'tests' . DS . 'fixtures' . DS;
if (!class_exists('CakeSchema')) {
App::import('Model', 'CakeSchema');
App::import('Model', 'CakeSchema', false);
}
}
@ -384,7 +384,7 @@ class FixtureTask extends Shell {
while (!$condition) {
$condition = $this->in($prompt, null, 'WHERE 1=1 LIMIT 10');
}
App::import('Core', 'Model');
App::import('Model', 'Model', false);
$modelObject =& new Model(array('name' => $modelName, 'table' => $useTable, 'ds' => $this->connection));
$records = $modelObject->find('all', array(
'conditions' => $condition,

View file

@ -20,7 +20,7 @@
* @since CakePHP(tm) v 1.2
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
App::import('Model', 'ConnectionManager');
App::import('Model', 'Model', false);
/**
* Task class for creating and updating model files.
@ -82,7 +82,6 @@ class ModelTask extends Shell {
* @return void
**/
function startup() {
App::import('Core', 'Model');
parent::startup();
}

View file

@ -20,7 +20,7 @@
* @since CakePHP(tm) v 1.2
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
App::import('Core', 'Controller');
App::import('Controller', 'Controller', false);
/**
* Task class for creating and updating view files.

View file

@ -26,7 +26,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
App::import('Core', 'Helper');
App::import('Helper', 'Helper', false);
/**
* This is a placeholder class.

View file

@ -226,7 +226,7 @@ class Dispatcher extends Object {
if (!isset($methods[strtolower($params['action'])])) {
if ($controller->scaffold !== false) {
App::import('Core', 'Scaffold');
App::import('Controller', 'Scaffold', false);
return new Scaffold($controller, $params);
}
return $this->cakeError('missingAction', array(array(

View file

@ -844,7 +844,7 @@ class App extends Object {
}
}
if (!App::import($tempType, $plugin . $class)) {
if (!App::import($tempType, $plugin . $class, $parent)) {
return false;
}
}
@ -866,7 +866,7 @@ class App extends Object {
if ($name != null && !class_exists($name . $ext['class'])) {
if ($load = $_this->__mapped($name . $ext['class'], $type, $plugin)) {
if ($_this->__load($load)) {
$_this->__overload($type, $name . $ext['class']);
$_this->__overload($type, $name . $ext['class'], $parent);
if ($_this->return) {
$value = include $load;
@ -908,7 +908,7 @@ class App extends Object {
if ($directory !== null) {
$_this->__cache = true;
$_this->__map($directory . $file, $name . $ext['class'], $type, $plugin);
$_this->__overload($type, $name . $ext['class']);
$_this->__overload($type, $name . $ext['class'], $parent);
if ($_this->return) {
$value = include $directory . $file;
@ -1058,8 +1058,8 @@ class App extends Object {
* @param string $name Class name to overload
* @access private
*/
function __overload($type, $name) {
if (($type === 'Model' || $type === 'Helper') && strtolower($name) != 'schema') {
function __overload($type, $name, $parent) {
if (($type === 'Model' || $type === 'Helper') && $parent !== false) {
Overloadable::overload($name);
}
}
@ -1088,10 +1088,10 @@ class App extends Object {
switch ($load) {
case 'model':
if (!class_exists('Model')) {
App::import('Model', 'Model', false, App::core('models'));
require LIBS . 'model' . DS . 'model.php';
}
if (!class_exists('AppModel')) {
App::import($type, 'AppModel', false, App::path('models'));
App::import($type, 'AppModel', false);
}
if ($plugin) {
if (!class_exists($plugin . 'AppModel')) {