Skip to content

Commit a4b3f9e

Browse files
committed
Fix potential issue in 1.10->1.11 migration with tpl object not being created correctly - refs BT#12085
1 parent 63d48a7 commit a4b3f9e

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

app/Migrations/Schema/V111/Version20160804174600.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -656,9 +656,10 @@ public function up(Schema $schema)
656656
$tpl = $em
657657
->getRepository('ChamiloCoreBundle:SystemTemplate')
658658
->findOneBy(['title' => $title]);
659-
$tpl->setContent($content);
660-
661-
$em->merge($tpl);
659+
if (!empty($tpl)) {
660+
$tpl->setContent($content);
661+
$em->merge($tpl);
662+
}
662663
}
663664

664665
$em->flush();
@@ -1213,11 +1214,12 @@ public function down(Schema $schema)
12131214
$tpl = $em
12141215
->getRepository('ChamiloCoreBundle:SystemTemplate')
12151216
->findOneBy(['title' => $title]);
1216-
$tpl->setContent($content);
1217-
1218-
$em->merge($tpl);
1217+
if (!empty($tpl)) {
1218+
$tpl->setContent($content);
1219+
$em->merge($tpl);
1220+
}
12191221
}
12201222

12211223
$em->flush();
12221224
}
1223-
}
1225+
}

0 commit comments

Comments
 (0)