Fixes to importing and merging of data fixtures from multiple files.
This commit is contained in:
parent
05119fe758
commit
852a2fdf87
@ -64,7 +64,7 @@ class Doctrine_Data_Import extends Doctrine_Data
|
|||||||
|
|
||||||
// If they specified a specific yml file
|
// If they specified a specific yml file
|
||||||
if (end($e) == 'yml') {
|
if (end($e) == 'yml') {
|
||||||
$array = array_merge($array, Doctrine_Parser::load($dir, $this->getFormat()));
|
$array = array_merge_recursive(Doctrine_Parser::load($dir, $this->getFormat()), $array);
|
||||||
// If they specified a directory
|
// If they specified a directory
|
||||||
} else if(is_dir($dir)) {
|
} else if(is_dir($dir)) {
|
||||||
$it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir),
|
$it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir),
|
||||||
@ -73,7 +73,7 @@ class Doctrine_Data_Import extends Doctrine_Data
|
|||||||
foreach ($it as $file) {
|
foreach ($it as $file) {
|
||||||
$e = explode('.', $file->getFileName());
|
$e = explode('.', $file->getFileName());
|
||||||
if (in_array(end($e), $this->getFormats())) {
|
if (in_array(end($e), $this->getFormats())) {
|
||||||
$array = array_merge($array, Doctrine_Parser::load($file->getPathName(), $this->getFormat()));
|
$array = array_merge_recursive(Doctrine_Parser::load($file->getPathName(), $this->getFormat()), $array);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -325,14 +325,14 @@ class Doctrine_Facade
|
|||||||
|
|
||||||
if ($delete)
|
if ($delete)
|
||||||
{
|
{
|
||||||
$models = Doctrine_Facade::getLoadedModels();
|
$models = Doctrine_Facade::getLoadedModels();
|
||||||
|
|
||||||
foreach ($models as $model)
|
foreach ($models as $model)
|
||||||
{
|
{
|
||||||
$model = new $model();
|
$model = new $model();
|
||||||
|
|
||||||
$model->getTable()->createQuery()->delete($model)->execute();
|
$model->getTable()->createQuery()->delete($model)->execute();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = new Doctrine_Data();
|
$data = new Doctrine_Data();
|
||||||
|
Loading…
Reference in New Issue
Block a user