Get comments.

@param $blogId
@param $postId
@param $userId
@param $filters
@param $allowedToSeeOnly
516450
public function getComments($blogId, $postId, $userId, $filters, $allowedToSeeOnly)
    {
        if (!isset($filters['hiddenFilters'])) {
            $filters['hiddenFilters'] = [];
        }
        //filter on current blog and post
        $filters['hiddenFilters'] = [
            'blog' => $blogId,
            'post' => $postId,
        ];

        //allow to see only published post, or post whose current user is the author
        if ($allowedToSeeOnly) {
            //anonymous only sees published
            if (null === $userId) {
                $options = [
                    'publishedOnly' => true,
                ];
            } else {
                $options = [
                    'allowedToSeeForUser' => $userId,
                ];
            }

            $filters['hiddenFilters'] = array_merge(
                $filters['hiddenFilters'],
                $options);
        }

        return $this->finder->search('Icap\BlogBundle\Entity\Comment', $filters);
    }
730526
def community_post_comments(self, post_id, **kwargs):
        ""
        api_path = "/api/v2/community/posts/{post_id}/comments.json"
        api_path = api_path.format(post_id=post_id)
        return self.call(api_path, **kwargs)
773398
function (filter) {
            if (!filter) {
                filter = null;
            }
            var comments = this.__comments;

            if (filter !== null) {
                comments = comments.filter(function (c) {
                    return c.context === filter;
                });
            }

            return comments;
        }
1149261
public function getComments()
    {
        $args_comments = [
            'post_id' => $this->ID,
            'orderby' => 'comment_date_gmt',
            'status' => static::STATUS_APPROVE,
        ];
        $comments = [];
        foreach (get_comments($args_comments, $this->ID) as $c) {
            $comments[] = Comment::find($c->comment_ID);
        }
        return $comments;
    }
795882
public function delete($blogId, $postId, $optParams = array()) {
      $params = array('blogId' => $blogId, 'postId' => $postId);
      $params = array_merge($params, $optParams);
      $data = $this->__call('delete', array($params));
      return $data;
    }
752705
public function all($blogId, array $params = array())
    {
        $endpoint = '/admin/blogs/'.$blogId.'/articles.json';
        $data = $this->request($endpoint, 'GET', $params);
        return $this->createCollection(Article::class, $data['articles']);
    }
1185190
private function getPost($postid)
    {
        $post = $this->getDoctrine()->getManager()->getRepository('VeonikBlogBundle:AbstractPost')
            ->createQueryBuilder('p')
            ->addSelect('c')
            ->leftJoin('p.comments', 'c')
            ->where('p.id = :post_id')
            ->setParameters(array(
                'post_id' => $postid
            ))
            ->getQuery()
            ->getOneOrNullResult();

        if (!$post) {
            throw $this->createNotFoundException('Unable to locate Post');
        }

        return $post;
    }
113557
public function addComment($postId, $comment)
	{
		$token = $this->oauth->getToken();

		// Set parameters.
		$parameters = array(
			'oauth_token' => $token['key'],
		);

		// Set the success response code.
		$this->oauth->setOption('success_code', 201);

		// Set the API base
		$base = '/v1/posts/' . $postId . '/comments';

		// Build xml.
		$xml = '<comment><text>' . $comment . '</text></comment>';

		// Build the request path.
		$path = $this->getOption('api.url') . $base;

		$header['Content-Type'] = 'text/xml';

		// Send the request.
		$response = $this->oauth->oauthRequest($path, 'POST', $parameters, $xml, $header);

		// Return the comment id.
		$response = explode('comments/', $response->headers['Location']);

		return $response[1];
	}
412068
public List<DbComment> getComments(String entityId, String entityType) {
        return repositoryHandler.getComments(entityId, entityType);
    }
245103
def get_comments(self):
        
        return github.PaginatedList.PaginatedList(
            github.GistComment.GistComment,
            self._requester,
            self.url + "/comments",
            None
        )
20508
function getCommentSQL ($xmldb_table) {

        $comment = "COMMENT ON TABLE " . $this->getTableName($xmldb_table);
        $comment.= " IS '" . $this->addslashes(substr($xmldb_table->getComment(), 0, 250)) . "'";

        return array($comment);
    }
1117298
function get_comments($page) {
        global $DB;

        if ($page == 0) {
            $start = 0;
        } else {
            $start = $page * $this->perpage;
        }
        $comments = array();

        $usernamefields = get_all_user_name_fields(true, 'u');
        $sql = "SELECT c.id, c.contextid, c.itemid, c.component, c.commentarea, c.userid, c.content, $usernamefields, c.timecreated
                  FROM {comments} c
                  JOIN {user} u
                       ON u.id=c.userid
              ORDER BY c.timecreated ASC";
        $rs = $DB->get_recordset_sql($sql, null, $start, $this->perpage);
        $formatoptions = array('overflowdiv' => true, 'blanktarget' => true);
        foreach ($rs as $item) {
            // Set calculated fields
            $item->fullname = fullname($item);
            $item->time = userdate($item->timecreated);
            $item->content = format_text($item->content, FORMAT_MOODLE, $formatoptions);
            // Unset fields not related to the comment
            foreach (get_all_user_name_fields() as $namefield) {
                unset($item->$namefield);
            }
            unset($item->timecreated);
            // Record the comment
            $comments[] = $item;
        }
        $rs->close();

        return $comments;
    }
1129189
public function get($blogId, array $fields = array())
    {
        $params = array();
        if (!empty($fields)) {
            $params['fields'] = implode(',', $fields);
        }
        $endpoint = '/admin/blogs/'.$blogId.'.json';
        $response = $this->request($endpoint, 'GET', $params);
        return $this->createObject(Blog::class, $response['blog']);
    }
58080
public function getComments(bool $nested = false)
    {
        $comments = $this->comments()->get();
        
        // If at least one comment is left by a registered user
        if ($comments->firstWhere('user_id', '>', 'null')) {
            $comments->load(['user:users.id,users.name,users.email,users.avatar']);
        }

        return $comments->treated($nested, $this->getAttributes());
    }
770073
public function getComment()
    {
        $postParameterBag = $this
            ->request
            ->query;
        $commentId = $postParameterBag->get('comment_id');
    
        if (empty($commentId)) {
            return new JsonResponse([
                'status' => 'Error',
                'message' => 'Some query parameters are missing',
            ], 400);
        }

        $commentReference = new CommentUUID($commentId);
        $comment = $this
            ->commentRepository
            ->findComment($commentReference)
            ->getFirstComment();
    
        if (!$comment instanceof Comment) {
            return new JsonResponse([
                'status' => 'Error',
                'message' => 'Comment not found',
            ], 404);
        }
        
    
        return new JsonResponse([
            'comment' => $comment->toArray(),
            'user' => $this->userCredentialsProvider->toArray(),
        ], 200);
    }
1129299
public function getComments($sql, $params)
    {
        $comments = $this->findAllWhere("$sql", $params);

        return array_map(function ($comment) {
            $user = new User($this->db);
            $comment->img = $user->getGravatar($comment->user);
            $comment->markdown = $this->getMD($comment->text);

            // Get votes for Post
            $vote = new Vote($this->db);
            $comment->vote = $vote->getVote("parentId = ? AND parentType = ?", [$comment->id, "comment"]);

            return $comment;
        }, $comments);
    }
1364012
private function getCommentsCountResetQuery($postTableName)
    {
        switch ($this->getConnection()->getDriver()->getDatabasePlatform()->getName()) {
            case 'postgresql':
                return sprintf('UPDATE %s SET comments_count = 0', $postTableName);

            default:
                return sprintf('UPDATE %s p SET p.comments_count = 0', $postTableName);
        }
    }