Phosphorum\Controllers\RepliesController::getAction PHP Method

getAction() public method

Returns the raw comment as it as edited
public getAction ( $id ) : Phalcon\Http\Response
$id
return Phalcon\Http\Response
    public function getAction($id)
    {
        $response = new Response();
        $usersId = $this->session->get('identity');
        if (!$usersId) {
            $response->setStatusCode(401, 'Unauthorized');
            return $response;
        }
        $parametersReply = ['id = ?0', 'bind' => [$id]];
        $postReply = PostsReplies::findFirst($parametersReply);
        if ($postReply) {
            $data = ['status' => 'OK', 'id' => $postReply->id, 'comment' => $postReply->content];
        } else {
            $data = ['status' => 'ERROR'];
        }
        $response->setJsonContent($data);
        return $response;
    }