I'm experimenting with Symfony and I am trying to make a POST request. But I can't seem to get the request's POST parameters inside my controller.
/**
* @Route("/messages/comment/post/", methods={"POST"}, name="postComment")
*/
public function postComment($messageId, $comment)
{
$statuscode = 200;
$response = null;
try {
$response = $this->messageModel->postComment($messageId, $comment);
} catch (\PDOException $exception) {
var_dump($exception);
$statuscode = 500;
}
return new JsonResponse($response, $statuscode);
}
How do I define parameters for this?
To get POST parameters inside a controller you should use:
Documentation here