Migration: Fix thread

pull/4002/head
Julio 5 years ago
parent 9ffbd63b63
commit 97724e2133
  1. 9
      src/CoreBundle/Migrations/Schema/V200/Version20201215160445.php

@ -203,7 +203,7 @@ final class Version20201215160445 extends AbstractMigrationChamilo
$items = $result->fetchAllAssociative();
$admin = $this->getAdmin();
foreach ($items as $itemData) {
$id = $itemData['iid'];
$id = (int) $itemData['iid'];
/** @var CForumPost $resource */
$resource = $forumPostRepo->find($id);
if ($resource->hasResourceNode()) {
@ -214,14 +214,12 @@ final class Version20201215160445 extends AbstractMigrationChamilo
$resource->setPostTitle(sprintf('Post #%s', $resource->getIid()));
}
$threadId = $itemData['thread_id'];
$threadId = (int) $itemData['thread_id'];
if (empty($threadId)) {
continue;
}
$course = $courseRepo->find($courseId);
/** @var CForumThread|null $thread */
$thread = $forumThreadRepo->find($threadId);
@ -230,11 +228,14 @@ final class Version20201215160445 extends AbstractMigrationChamilo
}
$forum = $thread->getForum();
// For some reason the thread doesn't have a forum, so we ignore the thread posts.
if (null === $forum) {
continue;
}
$course = $courseRepo->find($courseId);
$result = $this->fixItemProperty(
'forum_post',
$forumPostRepo,

Loading…
Cancel
Save