Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [SF][Symfony2]Trasa routera nie odbiera parametru., ("article_id") to generate a URL for route "multimedia_art
q3trm
post
Post #1





Grupa: Zarejestrowani
Postów: 83
Pomógł: 1
Dołączył: 26.02.2013

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


Witam.


Męcze się z brakiem odbioru parametru przez router.

  1. multimedia_article_comment:
  2. pattern: /comment/{article_id}
  3. defaults: { _controller: MultimediaArticleBundle:Comment:create }
  4. requirements:
  5. _method: POST
  6. article_id: \d+



  1. {{render (controller("MultimediaArticleBundle:Comment:new",{'article_id':article.id})) }} // linia 45


An exception has been thrown during the rendering of a template ("Some mandatory parameters are missing ("article_id") to generate a URL for route "multimedia_article_comment".") in MultimediaArticleBundle:Article:show.html.twig at line 45.


Sprawdziłem zmienną article.id - istnieje i zwraca numer artykółu.

  1. public function newAction($article_id) {
  2.  
  3. $article = $this -> getArticle($article_id);
  4.  
  5. $comments = new Comments();
  6. $comments -> setArticle($article);
  7.  
  8. $form = $this -> createForm (new CommentsType(), $comments);
  9.  
  10. return $this -> render('MultimediaArticleBundle:Comment:new.html.twig', array (
  11. 'comments' => $comments,
  12. 'form' => $form ->createView()
  13. ));
  14. }


Syntaktycznie nie widzę błędu, natomiast w technice nie mam doświadczenia (IMG:style_emoticons/default/nerdsmiley.png) . Jeżeli ktoś byłby tak szczodry podzielić się swym doświadczeniem, byłbym dozgodnie wdzięczny.
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: 7.10.2025 - 20:58