O meu $dadosEmJson está retornando null.
<?php
namespace App\Controller;
use App\Entity\Medico;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\JsonResponse;
class MedicosController {
/**
* @Route("/medicos", methods={"POST"})
*/
public function novo(Request $request): Response {
$corpoRequisicao = $request->getContent();
$dadosEmJson = json_decode($corpoRequisicao);
var_dump($dadosEmJson);
exit();
$medico = new Medico();
$medico->crm = $dadosEmJson->crm;
$medico->nome = $dadosEmJson->nome;
return new JsonResponse($medico);
}
}