Skip to content

Commit

Permalink
fixing up some App::import calls
Browse files Browse the repository at this point in the history
  • Loading branch information
gwoo committed Jul 30, 2009
1 parent 1423b00 commit 01d22ff
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion cake/console/libs/bake.php
Expand Up @@ -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));
}

Expand Down
2 changes: 1 addition & 1 deletion cake/console/libs/schema.php
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions cake/console/libs/tasks/fixture.php
Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -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,
Expand Down
3 changes: 1 addition & 2 deletions cake/console/libs/tasks/model.php
Expand Up @@ -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.
Expand Down Expand Up @@ -82,7 +82,6 @@ class ModelTask extends Shell {
* @return void
**/
function startup() {
App::import('Core', 'Model');
parent::startup();
}

Expand Down
2 changes: 1 addition & 1 deletion cake/console/libs/tasks/view.php
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion cake/console/libs/templates/skel/app_helper.php
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion cake/dispatcher.php
Expand Up @@ -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(
Expand Down
14 changes: 7 additions & 7 deletions cake/libs/configure.php
Expand Up @@ -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;
}
}
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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')) {
Expand Down

0 comments on commit 01d22ff

Please sign in to comment.