mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-15 14:03:27 +00:00
Fix doctrine transaction in lazaret patch
This commit is contained in:
@@ -81,10 +81,8 @@ class patch_370a7 implements patchInterface
|
||||
$this->truncateTable($app['EM'], 'Entities\\LazaretFile');
|
||||
$this->truncateTable($app['EM'], 'Entities\\LazaretSession');
|
||||
|
||||
// suspend auto-commit
|
||||
$app['EM']->getConnection()->beginTransaction();
|
||||
$i = 0;
|
||||
|
||||
try {
|
||||
foreach ($rs as $row) {
|
||||
|
||||
$filePath = $app['root.path'] . '/tmp/lazaret/' . $row['filepath'];
|
||||
@@ -137,14 +135,16 @@ class patch_370a7 implements patchInterface
|
||||
$lazaretFile->setSession($lazaretSession);
|
||||
|
||||
$app['EM']->persist($lazaretFile);
|
||||
|
||||
if (0 === ++$i % 100) {
|
||||
$app['EM']->flush();
|
||||
$app['EM']->clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$app['EM']->flush();
|
||||
} catch (\Exception $e) {
|
||||
$app['EM']->getConnection()->rollback();
|
||||
$app['EM']->close();
|
||||
}
|
||||
$app['EM']->clear();
|
||||
|
||||
$stmt->closeCursor();
|
||||
|
||||
|
Reference in New Issue
Block a user