Witam, borykam się z takim problem, otóż tworzę akcję kontrollera rozbitą na dwa kroki.
O ile w pierwszym kroku wszystko działa o tyle w drugim mam taki błąd, przy wejściu do drugiego kroku.
AppBundle\Entity\GroupWords object not found.
404 Not Found - NotFoundHttpException
Oto kod tych akcji:
/**
* Creates a new GroupWords entity.
*
* @Route("/new", name="groupwords_new")
* @Method({"GET", "POST"})
*/
public function newAction(Request $request)
{
$groupWord = new GroupWords();
$form = $this->createForm('AppBundle\Form\GroupWordsType', $groupWord);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
//$em = $this->getDoctrine()->getManager();
// $em->persist($groupWord);
// $em->fluvar_dump('saafa');
return $this->redirectToRoute('groupwords_new_step2', array('groupWord' => $groupWord)); }
return $this->render('groupwords/new.html.twig', array( 'groupWord' => $groupWord,
'form' => $form->createView(),
));
}
/**
* @Route("/new_step2/{groupWord}", name="groupwords_new_step2")
* @Method({"GET","POST"})
* @param Request $request
*
*
*/
public function newStep2Action(Request $request, GroupWords $groupWord){
$form = $this->createForm('AppBundle\Form\GroupWordsStep2Type', $groupWord);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($groupWord);
$em->flush();
return $this->redirectToRoute('groupwords_show', array('id' => $groupWord->getId())); }
return $this->render('groupwords/newStep2.html.twig', array( 'groupWord' => $groupWord,
'form' => $form->createView(),
));
}
Próbowałem to poustawiać przez @ParamConverter ale za wiele to nie zmieniło.
Pozdrawiam