Skip to content
Browse files

merge fixtures before loading them

  • Loading branch information...
1 parent 3f4be39 commit 792beb782a2c22388b861726b44a6adbf1deb19a @havvg havvg committed
Showing with 7 additions and 4 deletions.
  1. +7 −4 DataFixtures/Loader/AbstractDataLoader.php
View
11 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 792beb7

Please sign in to comment.
Something went wrong with that request. Please try again.