Por favor poderiam me ajudar
Attempted to load class "Medico" from namespace "App\Controller". Did you forget a "use" statement for another namespace?
Ao rodar no Postman ocorre o erro acima
<?php
namespace App\Controller;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route;
class MedicosController { /**
* @Route("/medicos", methods={"POST"})
*/
public function novo(Request $request): Response
{
$corpoRequisicao = $request->getContent();
$dadosEmJson = json_decode($corpoRequisicao);
$medico = new Medico();
$medico->crm = $dadosEmJson->crm;
$medico->nome = $dadosEmJson->nome;
return new JsonResponse($medico);
}
}
<?php
namespace App\Medico;
class Medico {
public $crm;
public $nome;
}