Permalink
Browse files

fixing up some App::import calls

  • Loading branch information...
1 parent 1423b00 commit 01d22ffd2eee8aa3686fe3c3fdb5420048d0df76 gwoo committed Jul 30, 2009
@@ -157,7 +157,7 @@ function all() {
$object = new $model();
$modelExists = true;
} else {
- App::import('Model');
+ App::import('Model', 'Model', false);
$object = new Model(array('name' => $name, 'ds' => $this->connection));
}
@@ -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.
@@ -74,7 +74,7 @@ function __construct(&$dispatch) {
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 @@ function _getRecordsFromTable($modelName, $useTable = null) {
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,
@@ -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();
}
@@ -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.
@@ -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
@@ -226,7 +226,7 @@ function _invoke(&$controller, $params) {
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
@@ -844,7 +844,7 @@ function import($type = null, $name = null, $parent = true, $search = array(), $
}
}
- if (!App::import($tempType, $plugin . $class)) {
+ if (!App::import($tempType, $plugin . $class, $parent)) {
return false;
}
}
@@ -866,7 +866,7 @@ function import($type = null, $name = null, $parent = true, $search = array(), $
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 @@ function import($type = null, $name = null, $parent = true, $search = array(), $
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 @@ function __mapped($name, $type, $plugin) {
* @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 @@ function __settings($type, $plugin, $parent) {
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')) {

0 comments on commit 01d22ff

Please sign in to comment.