Skip to content
Permalink
Browse files

Refactoring out to use DbConfig::getConfig

Continuing fixture bake
  • Loading branch information...
markstory committed Apr 29, 2009
1 parent 802ed73 commit 0b40e5c709ea16ae865574f32763a3a859bb9f94
Showing with 9 additions and 14 deletions.
  1. +7 −2 cake/console/libs/tasks/fixture.php
  2. +2 −12 cake/console/libs/tasks/model.php
@@ -42,7 +42,7 @@ class FixtureTask extends Shell {
* @var array
* @access public
*/
var $tasks = array('Model');
var $tasks = array('DbConfig', 'Model');
/**
* path to fixtures directory
*
@@ -107,7 +107,12 @@ function all() {
* @access private
*/
function __interactive($modelName = false) {
$this->interactive = true;
$this->hr();
$this->out(sprintf("Bake Fixture\nPath: %s", $this->path));
$this->hr();
$useDbConfig = $this->DbConfig->getConfig();
}
/**
@@ -117,18 +117,8 @@ function __interactive() {
$primaryKey = 'id';
$validate = array();
$associations = array('belongsTo'=> array(), 'hasOne'=> array(), 'hasMany' => array(), 'hasAndBelongsToMany'=> array());
$useDbConfig = 'default';
$configs = get_class_vars('DATABASE_CONFIG');
if (!is_array($configs)) {
return $this->DbConfig->execute();
}
$connections = array_keys($configs);
if (count($connections) > 1) {
$useDbConfig = $this->in(__('Use Database Config', true) .':', $connections, 'default');
}
$useDbConfig = $this->DbConfig->getConfig();
$currentModelName = $this->getName($useDbConfig);
$db =& ConnectionManager::getDataSource($useDbConfig);

0 comments on commit 0b40e5c

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