public function getCommentsCount(JsonSerializationVisitor $visitor, $data, $type) { $commentsCount = $this->commentService->getCommentCounts(array($data->number), false, true); if (count($commentsCount)) { return $commentsCount[0][1]; } return 0; }