diff --git a/views/user/notification.php b/views/user/notification.php index c570233..9ebc0ca 100644 --- a/views/user/notification.php +++ b/views/user/notification.php @@ -12,17 +12,23 @@ switch ($notification->type) { break; case Notifications::typeNewCommentPoint: $comment = $notification->RefComment; - $point = Point::model()->getByPK($comment->parentId); - print strftime('%d %b %H:%M', $notification->date).' — Новый комментарий к точке "'.$point->name.'".'; + if ($comment) { + $point = Point::model()->getByPK($comment->parentId); + print strftime('%d %b %H:%M', $notification->date).' — Новый комментарий к точке "'.$point->name.'".'; + } break; case Notifications::typeNewCommentArticle: $comment = $notification->RefComment; - $article = Article::model()->getByPK($comment->parentId); - print strftime('%d %b %H:%M', $notification->date).' — Новый комментарий к статье "'.$article->title.'".'; + if ($comment) { + $article = Article::model()->getByPK($comment->parentId); + print strftime('%d %b %H:%M', $notification->date).' — Новый комментарий к статье "'.$article->title.'".'; + } break; case Notifications::typeReply: $comment = $notification->RefComment; - print strftime('%d %b %H:%M', $notification->date).' — '.$comment->RefUser->nick.' ответил(-а) на ваш комментарий.'; + if ($comment) { + print strftime('%d %b %H:%M', $notification->date).' — '.$comment->RefUser->nick.' ответил(-а) на ваш комментарий.'; + } break; case Notifications::typePointLike: print strftime('%d %b %H:%M', $notification->date).' — '.$notification->RefFromUser->nick.' нравится ваша точка '.$notification->RefPoint->name.'.';