Get comments of an applications

@param $commentOrId
@internal param \Application\Entity\Comment $comment | Id
@return \Applications\Entity\Comment|NULL
162429
public function findComment($commentOrId)
    {
        if ($commentOrId instanceof CommentInterface) {
            $commentOrId = $commentOrId->getId();
        }
        
        $application = $this->findOneBy(array('comments.id' => $commentOrId));
        /* @var \Applications\Entity\Comment $comment */
        foreach ($application->getComments() as $comment) {
            if ($comment->getId() == $commentOrId) {
                return $comment;
            }
        }
        return null;
    }
1235563
public function GetNew($DiscussionID, $LastCommentID) {
      $this->CommentQuery();
      $this->FireEvent('BeforeGetNew');
      $this->OrderBy($this->SQL);
      $Comments = $this->SQL
         ->Where('c.DiscussionID', $DiscussionID)
         ->Where('c.CommentID >', $LastCommentID)
         ->Get();
      
      $this->SetCalculatedFields($Comments);
      return $Comments;
   }
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;
    }
1169836
public function setComment(\Innova\CollecticielBundle\Entity\Comment $comment)
    {
        $this->comment = $comment;

        return $this;
    }
672527
def getComment(self, repo_user, repo_name, comment_id):
        
        return self.api.makeRequest(
            ['repos', repo_user, repo_name,
             'pulls', 'comments', str(comment_id)])
1374950
public function extractDoctrineTypeFromComment($comment, $currentType)
    {
        if ($comment !== null && preg_match('(\(DC2Type:(((?!\)).)+)\))', $comment, $match)) {
            return $match[1];
        }

        return $currentType;
    }
446566
public function getPostEditComment($id)
    {
        $form = new EditCommentForm($this->di, $id);
        $form->check();

        $views = [
            ["comment/default-form", ["form" => $form->getHTML()], "main"]
        ];

        $this->di->get("pageRenderComment")->renderPage([
            "views" => $views,
            "title" => "Edit comment | $id"
        ]);
    }
746726
public function getCommentVotes(CommentInterface $comment)
    {
        /**
         * @var VoteInterface[] $votes
         */
        $votes = $this
            ->commentVoteObjectDirector
            ->findBy([
                'comment' => $comment,
            ]);

        return VotePackage::create($votes);
    }
185824
public function delete($commentid) {
        global $DB, $USER;
        $candelete = has_capability('moodle/comment:delete', $this->context);
        if (!$comment = $DB->get_record('comments', array('id'=>$commentid))) {
            throw new comment_exception('dbupdatefailed');
        }
        if (!($USER->id == $comment->userid || !empty($candelete))) {
            throw new comment_exception('nopermissiontocomment');
        }
        $DB->delete_records('comments', array('id'=>$commentid));
        // Trigger comment delete event.
        if (core_component::is_core_subsystem($this->component)) {
            $eventclassname = '\\core\\event\\' . $this->component . '_comment_deleted';
        } else {
            $eventclassname = '\\' . $this->component . '\\event\comment_deleted';
        }
        if (class_exists($eventclassname)) {
            $event = $eventclassname::create(
                    array(
                        'context' => $this->context,
                        'objectid' => $commentid,
                        'other' => array(
                            'itemid' => $this->itemid
                            )
                        ));
            $event->add_record_snapshot('comments', $comment);
            $event->trigger();
        }
        return true;
    }
848553
def get_comments_by_search(self, comment_query, comment_search):
        """"""
        # Implemented from azosid template for -
        # osid.resource.ResourceSearchSession.get_resources_by_search_template
        if not self._can('search'):
            raise PermissionDenied()
        return self._provider_session.get_comments_by_search(comment_query, comment_search)
346336
public function comments()
    {
        if (is_null($this->commentRequests)) {
            $this->commentRequests = new CommentRequests($this->client);
        }

        return $this->commentRequests;
    }
971566
public function updateComment( $comment, $user=null, $time = null , $notified = null )
    {
        if ( $time === null )
        {
            $time = time();
        }

        $beforeUpdating = $this->beforeUpdatingComment( $comment, $notified, $time );
        if ( $beforeUpdating !== true )
        {
            return $beforeUpdating;
        }
        $comment->store();

        $afterUpdating = $this->afterUpdatingComment( $comment, $notified, $time );
        if ( $afterUpdating !== true )
        {
            return $afterUpdating;
        }
        return true;
    }
860195
private function getCommentsCountQuery($postTableName, $commentTableName)
    {
        switch ($this->getConnection()->getDriver()->getDatabasePlatform()->getName()) {
            case 'postgresql':
                return sprintf(
            'UPDATE %s SET comments_count = count_comment.total
            FROM (SELECT c.post_id, count(*) AS total FROM %s AS c WHERE c.status = 1 GROUP BY c.post_id) count_comment
            WHERE %s.id = count_comment.post_id', $postTableName, $commentTableName, $postTableName);

            default:
                return sprintf(
            'UPDATE %s p, (SELECT c.post_id, count(*) as total FROM %s as c WHERE c.status = 1 GROUP BY c.post_id) as count_comment
            SET p.comments_count = count_comment.total
            WHERE p.id = count_comment.post_id', $postTableName, $commentTableName);
        }
    }
413648
public function serialize(ResourceComment $comment, array $options = [])
    {
        $serialized = [
            'id' => $comment->getUuid(),
            'content' => $comment->getContent(),
            'user' => $comment->getUser() ? $this->userSerializer->serialize($comment->getUser(), [Options::SERIALIZE_MINIMAL]) : null,
            'creationDate' => $comment->getCreationDate() ? DateNormalizer::normalize($comment->getCreationDate()) : null,
            'editionDate' => $comment->getEditionDate() ? DateNormalizer::normalize($comment->getEditionDate()) : null,
        ];

        return $serialized;
    }
113059
protected function getAlterTableComment($table, $comment)
    {
        $table = $this->dba->ident($table);
        $commentSave = $this->dba->quote($comment);

        return sprintf("%s\$this->execute(\"ALTER TABLE %s COMMENT=%s;\");", $this->ind2, $table, $commentSave);
    }
806987
private function parseComment(RefComment $comment = null)
    {
        if ($comment === null) {
            return [];
        }

        $annotations = $this->docParser->parse($comment->text);

        foreach ($annotations as $key => $annotation) {
            if (!$annotation instanceof Annotation) {
                unset($annotations[$key]);
                continue;
            }

            if ($annotation instanceof ContentInterface) {
                $content = $this->extractContent($comment->text, get_class($annotation));
                $annotation->setContent($content);
            }
        }

        return $annotations;
    }
984006
public function vote($commentId, $vote)
    {
        $this->validateVoteArgument($vote, ['up', 'down']);

        return $this->post('comment/' . $commentId . '/vote/' . $vote);
    }