Permalink
Browse files

Merge pull request #147 from havvg/hotfix/foreignkey-dataloader

merge fixtures before loading them
  • Loading branch information...
2 parents a93ea28 + 792beb7 commit f50df06a8b4108396276348c00639908dcdb511e @willdurand willdurand committed May 2, 2012
Showing with 7 additions and 4 deletions.
  1. +7 −4 DataFixtures/Loader/AbstractDataLoader.php
@@ -60,16 +60,19 @@ public function load($files = array(), $connectionName)
try {
$this->con->beginTransaction();
+ $datas = array();
foreach ($files as $file) {
- $datas = $this->transformDataToArray($file);
+ $content = $this->transformDataToArray($file);
- if (count($datas) > 0) {
- $this->deleteCurrentData($datas);
- $this->loadDataFromArray($datas);
+ if (count($content) > 0) {
+ $datas = array_merge($datas, $content);
$nbFiles++;
}
}
+ $this->deleteCurrentData($datas);
+ $this->loadDataFromArray($datas);
+
$this->con->commit();
} catch (\Exception $e) {
$this->con->rollBack();

0 comments on commit f50df06

Please sign in to comment.