Get one comment by id

@return JsonResponse
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);
    }
1280954
public List<Comment> getComment(int id) {
        ClientResource resource = new ClientResource(Route.GET_COMMENT.url(id));
        try {
            String result = resource.get().getText();
            return mapper.readValue(result, new TypeReference<List<Comment>>() {});
        } catch (IOException ex) {
            LEX4JLogger.log(Level.WARNING, "Could not retrieve lot comments correctly!");
            return null;
        }
    }
37224
def comment_delete(self, comment_id):
        
        return self._get('comments/{0}.json'.format(comment_id),
                         method='DELETE', auth=True)
214781
protected function getComment($id)
    {
        $comment = $this->commentManager->find($id);

        if (null === $comment) {
            throw new NotFoundHttpException(sprintf('Comment (%d) not found', $id));
        }

        return $comment;
    }
1243426
public function AllComments()
    {
        $order = $this->owner->getCommentsOption('order_comments_by');
        $comments = Comment::get()
            ->filter('ParentID', $this->owner->ID)
            ->sort($order);
        $this->owner->extend('updateAllComments', $comments);
        return $comments;
    }
288568
function getComments(id) {
    $.ajax({
     type: 'GET',
     url: opts.getCommentsURL,
     data: {node: id},
     success: function(data, textStatus, request) {
       var ul = $('#cl' + id);
       var speed = 100;
       $('#cf' + id)
         .find('textarea[name="proposal"]')
         .data('source', data.source);

       if (data.comments.length === 0) {
         ul.html('<li>No comments yet.</li>');
         ul.data('empty', true);
       } else {
         // If there are comments, sort them and put them in the list.
         var comments = sortComments(data.comments);
         speed = data.comments.length * 100;
         appendComments(comments, ul);
         ul.data('empty', false);
       }
       $('#cn' + id).slideUp(speed + 200);
       ul.slideDown(speed);
     },
     error: function(request, textStatus, error) {
       showError('Oops, there was a problem retrieving the comments.');
     },
     dataType: 'json'
    });
  }
1248556
public function get($id = null)
    {

        // Prep the endpoint
        $endpoint = ($id) ? $this->getEndpoint() . "/" . $id : $this->getEndpoint();

        // Get the resource
        $response = $this->client->get($endpoint, $this->prepareParams());

        // Handle response
        return $this->handleResponse(json_decode($response));

    }
195181
def get(request, obj_id):
    
    res = Result()
    c = Comment.objects.get(pk=obj_id)
    res.append(commentToJson(c))

    return JsonResponse(res.asDict())
231384
public function getModalDelete($id = null)
    {
        $confirm_route = $error = null;

        $title = 'Delete comment';
        $message = 'Are you sure to delete this comment?';

        // Get post information
        $comment = Comments::getCommentsRepository()->findOrFail($id);

        if ($comment == null)
        {
            // Prepare the error message
            $error = Lang::get('comments.comment.not_found');
            return View('layouts.modal_confirmation', compact('title', 'message', 'error', 'model', 'confirm_route'));
        }

        $confirm_route = route('delete/comment', ['id' => $comment->id]);
        return View('layouts.modal_confirmation', compact('title', 'message', 'error', 'model', 'confirm_route'));
    }
52038
public function updateComment($id, $data, Model $parent = null)
    {
        $commentableModel = $this->commentableModel();

        $comment = (new $commentableModel())->updateComment($id, $data);

        if (!empty($parent)) {
            $parent->appendNode($comment);
        }

        return $comment;
    }
384804
def get_comments(self, commentable_type, id_):
    
    return _get_request(_COM.format(c_api=_C_API_BEGINNING,
                                            ct=commentable_type,
                                            id_=id_,
                                            api=_API_VERSION,
                                            at=self.access_token))
558533
public function getComment() : ?string 
    {
        if ( ! $this->hasComment()) {
            $this->setComment($this->getDefaultComment());
        }
        return $this->comment;
    }
223009
public function findOrFail($id)
    {
        $comment = $this->find($id);

        if (! $comment->getAdaptee()) {
            throw new QueryException("Comment [{$id}] not found.");
        }

        return $comment;
    }
557355
def get(self, id):
        
        rv = self.db.execute(
            'SELECT * FROM comments WHERE id=?', (id, )).fetchone()
        if rv:
            return dict(zip(Comments.fields, rv))

        return None
213329
public function getComments()
    {
        //setup the comments
        $comment_ids = $this->getIds('comment');

        $comments = array();

        //only shows comments if there are comment_ids in the story
        //body or if the story has directly been commented on
        if (!empty($comment_ids)) {
            sort($comment_ids);
            $size = 0;
            foreach ($comment_ids as $id) {
                if (isset($this->_loaded_nodes[$id])) {
                    $comment = $this->_loaded_nodes[$id];
                    if ($comment instanceof ComBaseDomainEntityComment) {
                        $comments[$id] = $comment;
                        ++$size;
                    }
                }
                if ($size == 10) {
                    break;
                }
            }
        }

        return $comments;
    }
795323
function send_comment( $id , $comment , $comment_ori = 0)
	{
		$params = array();
		$params['comment'] = $comment;
		$this->id_format($id);
		$params['id'] = $id;
		$params['comment_ori'] = $comment_ori;
		return $this->oauth->post( 'comments/create', $params );
	}
352747
public function actionReply($id)
    {
        $comment = $this->findModel($id);
        if (!\Yii::$app->user->can('replyStranger', ['comment' => $comment]))
            return $this->alert(\Yii::t('app', 'Access denied.'));
        
        // fill in a new Comment
        $model = $this->newModel();
        $model->model = $comment->model;
        $model->parent_id = $comment->parent_id;
        $model->thread = $comment->thread;
        $model->user_id = \Yii::$app->user->id; // comment of a current user
        $model->status = Comment::STATUS_APPROVED; // comment approved by default
        $model->last = 1; // only the last comment in the thread can be replied

        if ($model->load(\Yii::$app->request->post()) && $model->save()) {
            // the comment to which we reply must be approved
            if ($comment->status == Comment::STATUS_PENDING) {
                $comment->status = Comment::STATUS_APPROVED;
                $comment->save(false);
            }
            return YII_DEBUG 
                ? $this->redirect(['index'])
                : $this->redirect(\Yii::$app->request->referrer);
        } else {
            return $this->renderAjax('reply', [
                'model' => $model,
                'comment' => $comment,
            ]);
        }
    }