Skip to content

Commit

Permalink
Merge pull request #190 from dbu/patch-1
Browse files Browse the repository at this point in the history
handle older versions of phpcr-odm
  • Loading branch information
lavoiesl committed Mar 30, 2015
2 parents 70020ae + fbe4215 commit bd44f6b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/Doctrine/Common/DataFixtures/Executor/PHPCRExecutor.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,21 @@ public function execute(array $fixtures, $append = false)
{
$that = $this;

$this->dm->transactional(function ($dm) use ($append, $that, $fixtures) {
$function = function ($dm) use ($append, $that, $fixtures) {
if ($append === false) {
$that->purge();
}

foreach ($fixtures as $fixture) {
$that->load($dm, $fixture);
}
});
};

if (method_exists($this->dm, 'transactional')) {
$this->dm->transactional($function);
} else {
$function($this->dm);
}
}
}

0 comments on commit bd44f6b

Please sign in to comment.