I have a form for adding a new receptor to my database. The first step is to inform various prescribing information.
Then I check if there are similar receptors before adding (2nd step with the 2nd form), and if there is, I ask the user to confirm.
In short, I have a 1-step form or a 2-step form, depending on duplicates.
I tried with CraueFormFlowBundle, but I don't know how to implement my conditional second step. My tests were inconclusive. So I decided to use the forward method in my controller, and I like it!
But I canβt clear my appointee at the end of the second step (after forwarding), I have this error: Unable to guess how to get a Doctrine instance from the request information for parameter "prescriber".
addAction (= step 1)
public function addAction(Request $request) { $em = $this->getDoctrine()->getManager(); $rp = $em->getRepository('AppBundle:Prescriber'); $p = new Prescriber();
addConfirmAction (= step 2)
public function addConfirmAction(Prescriber $prescriber, $duplicates, Request $request) { $em = $this->getDoctrine()->getManager(); $form = $this->createFormBuilder()->getForm(); if ($form->handleRequest($request)->isValid()) { $em->persist($prescriber); $em->flush(); $this->addFlash('p_success', 'Prescriber has been created successfully'); return $this->redirectToRoute('prescriber'); }
I think the problem is that I have 2 forms of presentation ...
source share