Skip to content

Commit

Permalink
Refactoring out to use DbConfig::getConfig
Browse files Browse the repository at this point in the history
Continuing fixture bake
  • Loading branch information
markstory committed Apr 29, 2009
1 parent 802ed73 commit 0b40e5c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
9 changes: 7 additions & 2 deletions cake/console/libs/tasks/fixture.php
Expand Up @@ -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
*
Expand Down Expand Up @@ -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();
}

/**
Expand Down
14 changes: 2 additions & 12 deletions cake/console/libs/tasks/model.php
Expand Up @@ -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);
Expand Down

0 comments on commit 0b40e5c

Please sign in to comment.