Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adding import()s to DbConfigTask and ModelTask to fix missing class e…

…rrors, when methods are run in certain orders.
  • Loading branch information...
commit 5f1d090bf0227d91fe1a4024d682c9f24ea88cba 1 parent f81d3da
@markstory markstory authored
View
3  cake/console/libs/tasks/db_config.php
@@ -353,9 +353,10 @@ function bake($configs) {
* @return void
**/
function getConfig() {
+ App::import('Model', 'ConnectionManager', false);
+
$useDbConfig = 'default';
$configs = get_class_vars($this->databaseClassName);
-
if (!is_array($configs)) {
return $this->execute();
}
View
16 cake/console/libs/tasks/model.php
@@ -76,16 +76,6 @@ class ModelTask extends Shell {
var $__validations = array();
/**
- * startup method
- *
- * @return void
- **/
- function startup() {
- App::import('Model', 'Model', false);
- parent::startup();
- }
-
-/**
* Execution method always used for tasks
*
* @access public
@@ -176,6 +166,8 @@ function inOptions($options, $prompt = null, $default = null) {
* @access private
*/
function __interactive() {
+ App::import('Model', 'Model', false);
+
$this->hr();
$this->out(sprintf("Bake Model\nPath: %s", $this->path));
$this->hr();
@@ -796,6 +788,8 @@ function getTable($modelName, $useDbConfig = null) {
if (!isset($useDbConfig)) {
$useDbConfig = $this->connection;
}
+ App::import('Model', 'ConnectionManager', false);
+
$db =& ConnectionManager::getDataSource($useDbConfig);
$useTable = Inflector::tableize($modelName);
$fullTableName = $db->fullTableName($useTable, false);
@@ -823,6 +817,8 @@ function getAllTables($useDbConfig = null) {
if (!isset($useDbConfig)) {
$useDbConfig = $this->connection;
}
+ App::import('Model', 'ConnectionManager', false);
+
$tables = array();
$db =& ConnectionManager::getDataSource($useDbConfig);
$usePrefix = empty($db->config['prefix']) ? '' : $db->config['prefix'];
Please sign in to comment.
Something went wrong with that request. Please try again.