Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [Symfony2][Symfony]Entity not found, Nie można odnaleźć entity
Crash89
post
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
 
Start new topic
Odpowiedzi
kpt_lucek
post
Post #2





Grupa: Zarejestrowani
Postów: 428
Pomógł: 77
Dołączył: 10.07.2011
Skąd: Warszawa

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


Polecam
Go to the top of the page
+Quote Post
Crash89
post
Post #3





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

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


Cytat(kpt_lucek @ 22.04.2016, 01:08:26 ) *



Użyłem tego craue i wszystko działa, ale mam problem gdy chcę wyświetlić wyniki w kroku drugim w zależności wyboru w kroku pierwszym.
Chcę wyświetlić do wyboru tylko te słowa, które dotyczą wybranego języka.

Mam przy kroku drugim taki błąd:

  1. The option "language" does not exist. Defined options are: "action", "allow_extra_fields", "attr", "auto_initialize", "block_name",


A gdy dodam metodę configureOptions gdzie się ustawia te domyślne wartośći, to wyrzuca mi coś takiego:

  1. Compile Error: Declaration of AppBundle\Form\CreateGroupWordsForm::configureOptions() must be compatible with Symfony\Component\Form\FormTypeInterface::configureOptions(Symfony\Component\OptionsResolver\OptionsResolver $resolver)

Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 11.10.2025 - 06:28