mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Refactoring out to use DbConfig::getConfig
Continuing fixture bake
This commit is contained in:
parent
802ed73c0a
commit
0b40e5c709
2 changed files with 9 additions and 14 deletions
|
@ -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 @@ class FixtureTask extends Shell {
|
|||
* @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 @@ class ModelTask extends Shell {
|
|||
$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);
|
||||
|
|
Loading…
Add table
Reference in a new issue