From 852a2fdf8734056873de6665e9552f792ec67ea8 Mon Sep 17 00:00:00 2001 From: "Jonathan.Wage" Date: Wed, 17 Oct 2007 01:54:27 +0000 Subject: [PATCH] Fixes to importing and merging of data fixtures from multiple files. --- lib/Doctrine/Data/Import.php | 4 ++-- lib/Doctrine/Facade.php | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/Doctrine/Data/Import.php b/lib/Doctrine/Data/Import.php index 05e3fec71..2d609e43f 100644 --- a/lib/Doctrine/Data/Import.php +++ b/lib/Doctrine/Data/Import.php @@ -64,7 +64,7 @@ class Doctrine_Data_Import extends Doctrine_Data // If they specified a specific yml file 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 } else if(is_dir($dir)) { $it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir), @@ -73,7 +73,7 @@ class Doctrine_Data_Import extends Doctrine_Data foreach ($it as $file) { $e = explode('.', $file->getFileName()); 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); } } } diff --git a/lib/Doctrine/Facade.php b/lib/Doctrine/Facade.php index 2cb214c8c..843a2cbea 100644 --- a/lib/Doctrine/Facade.php +++ b/lib/Doctrine/Facade.php @@ -325,14 +325,14 @@ class Doctrine_Facade if ($delete) { - $models = Doctrine_Facade::getLoadedModels(); + $models = Doctrine_Facade::getLoadedModels(); - foreach ($models as $model) - { - $model = new $model(); + foreach ($models as $model) + { + $model = new $model(); - $model->getTable()->createQuery()->delete($model)->execute(); - } + $model->getTable()->createQuery()->delete($model)->execute(); + } } $data = new Doctrine_Data();