Je n'arrive pas a afficher le formulaire d'ajouter d'un nouveau Dossier
#[Route('/dossier/new', name: 'dossier_new', methods: ['GET', 'POST'])]
public function new(Request $request, Security $security): Response
{
if (!$this->isGranted('IS_AUTHENTICATED_FULLY')) {
return $this->redirectToRoute('fos_user_security_login');
}
$dossier = new Dossier();
$demandeur = new Demandeur();
$piecejointe = new PiecesJointe();
//$form = $this->createForm(DossierType::class, $dossier);
//$formDemand = $this->createForm(DemandeurType::class, $demandeur);
//$formPJ = $this->createForm(PiecesJointeType::class, $piecejointe);
$form = $this->createForm(DossierType::class, $dossier);
$formDemand = $this->createForm(DemandeurType::class, $demandeur);
$formPJ = $this->createForm(PiecesJointeType::class, $piecejointe);
$form->handleRequest($request);
$formDemand->handleRequest($request);
$formPJ->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager();
$dossier->setNumeroDossier($em->getRepository(Dossier::class)->getNumeroDispo());
$id_d = $dossier->getDemandeur();
if ($id_d === null) {
$em->persist($demandeur);
$em->flush();
$dossier->setDemandeur($demandeur);
} else {
$dossier->setDemandeur($id_d);
}
$dossier->setDateEnregistrement(new \DateTime());
$dossier->setSupp(false);
$em->persist($dossier);
$em->flush();
$dossier->upload();
$dossier->upload2();
$session = $request->getSession();
$session->set('dossier', $dossier);
// Redirect or handle success
return $this->redirectToRoute('page_accueil'); // Replace with your success route
}
// Render form view or return response
return $this->render('dossier/new.html.twig', [
'form' => $form->createView(),
'formDemand' => $formDemand->createView(),
'formPJ' => $formPJ->createView(),
]);
}
Ce que je veux
Enregistrer un nouveau Dossier
Ce que j'obtiens
Could not load type "App\Form\Type": class does not exist.
est ce que tu as la page complete de l'erreur ? il precise ou regarder. il doit te manquer un use quelque part