diff --git a/src/CoreBundle/Migrations/Schema/V200/Version20201215160445.php b/src/CoreBundle/Migrations/Schema/V200/Version20201215160445.php index 1da01d5d4e..0a4e64ff2d 100644 --- a/src/CoreBundle/Migrations/Schema/V200/Version20201215160445.php +++ b/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,