Added warning about comments w/o post in migration

This commit is contained in:
Marcin Kurczewski 2014-10-17 19:26:01 +02:00
parent 1f993d37b3
commit f39b97c072

View file

@ -411,6 +411,11 @@ class CopyCommentsTask extends SourcePdoTask
$commentDao = Injector::get(CommentDao::class); $commentDao = Injector::get(CommentDao::class);
$this->commitInChunks($this->sourcePdo->query('SELECT * FROM comment'), function($arr) use ($commentDao) $this->commitInChunks($this->sourcePdo->query('SELECT * FROM comment'), function($arr) use ($commentDao)
{ {
if (!$arr['post_id'])
{
$this->warn('Missing ID for comment #' . $arr['id']);
return;
}
$comment = new Comment(); $comment = new Comment();
$comment->setPostId($arr['post_id']); $comment->setPostId($arr['post_id']);
$comment->setUserId($arr['commenter_id']); $comment->setUserId($arr['commenter_id']);