Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [Symfony2][Symfony]Entity not found, Nie można odnaleźć entity
Crash89
post 19.04.2016, 17:36:42
Post #1





Grupa: Zarejestrowani
Postów: 191
Pomógł: 7
Dołączył: 3.04.2013

Ostrzeżenie: (0%)
-----


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.

  1. AppBundle\Entity\GroupWords object not found.
  2. 404 Not Found - NotFoundHttpException


Oto kod tych akcji:

  1. /**
  2.   * Creates a new GroupWords entity.
  3.   *
  4.   * @Route("/new", name="groupwords_new")
  5.   * @Method({"GET", "POST"})
  6.   */
  7. public function newAction(Request $request)
  8. {
  9. $groupWord = new GroupWords();
  10. $form = $this->createForm('AppBundle\Form\GroupWordsType', $groupWord);
  11. $form->handleRequest($request);
  12.  
  13. if ($form->isSubmitted() && $form->isValid()) {
  14. //$em = $this->getDoctrine()->getManager();
  15. // $em->persist($groupWord);
  16. // $em->fluvar_dump('saafa');
  17.  
  18.  
  19. return $this->redirectToRoute('groupwords_new_step2', array('groupWord' => $groupWord));
  20. }
  21.  
  22. return $this->render('groupwords/new.html.twig', array(
  23. 'groupWord' => $groupWord,
  24. 'form' => $form->createView(),
  25. ));
  26. }
  27. /**
  28.  * @Route("/new_step2/{groupWord}", name="groupwords_new_step2")
  29.  * @Method({"GET","POST"})
  30.  * @param Request $request
  31.  *
  32.  *
  33.  */
  34. public function newStep2Action(Request $request, GroupWords $groupWord){
  35. $form = $this->createForm('AppBundle\Form\GroupWordsStep2Type', $groupWord);
  36. $form->handleRequest($request);
  37.  
  38. if ($form->isSubmitted() && $form->isValid()) {
  39. $em = $this->getDoctrine()->getManager();
  40. $em->persist($groupWord);
  41. $em->flush();
  42.  
  43. return $this->redirectToRoute('groupwords_show', array('id' => $groupWord->getId()));
  44. }
  45. return $this->render('groupwords/newStep2.html.twig', array(
  46. 'groupWord' => $groupWord,
  47. 'form' => $form->createView(),
  48. ));
  49.  
  50. }



Próbowałem to poustawiać przez @ParamConverter ale za wiele to nie zmieniło.

Pozdrawiam
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 14.08.2025 - 02:26