Jestem w trakcie poznawania Symfony i natknąłem się na błąd.
W ramach nauki pisze prosty blog.
W moim kontrolerze renderuje widok z listą postów - wszystko jest ok.
Postanowiłem dać jakiś główny szablon, w tym celu stworzyłem plik layout.html.twig w folderze src/Milek/BlogBundle/Resources/views/ - jego zawartość:
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  3. <head>
  4. <meta name="author" content="Luka Cvrk" />
  5. <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  6. <title>INTERACTIVE MEDIA using media to broadcast content</title>
  7. </head>
  8. <body id="home">
  9. {% block content %}
  10. {% endblock %}
  11. </body>
  12. </html>


zawartość pliku src/Milek/BlogBundle/Resources/views/Post/index.html.twig:
  1. {# src/Milek/BlogBundle/Resources/views/Post/index.html.twig #}
  2. {% extends "MilekBlogBundle::layout.html.twig" %}
  3.  
  4. {% block content %}
  5. {% for post in posts %}
  6. <div class="post">
  7. <div class="header"><a href="{{ path('post_show', { 'slug': post.getSlug() }) }}">{{ post.getTitle() }}</a></div>
  8. <div>{{ post.getContent() }}</div>
  9. </div>
  10. {% endfor %}
  11. {% endblock %}


A to treść wyjątku:
Cytat
An exception has been thrown during the rendering of a template ("Route "_wdt" does not exist.") in WebProfilerBundle:Profiler:toolbar_js.html.twig at line 11.


Sprawa jest o tyle dziwna, że gdy usunę z pliku layout.html.twig dwie ostatnie linie, to wszystko jest ok.

Ok - poradziłem sobie. Wystarczyło w pliku routing_dev.yml dać kod który usunąłem wcześniej, czyli:
Kod
_assetic:
    resource: .
    type:     assetic

_wdt:
    resource: "@WebProfilerBundle/Resources/config/routing/wdt.xml"
    prefix:   /_wdt

_profiler:
    resource: "@WebProfilerBundle/Resources/config/routing/profiler.xml"
    prefix:   /_profiler

_configurator:
    resource: "@SensioDistributionBundle/Resources/config/routing/webconfigurator.xml"
    prefix:   /_configurator

_main:
    resource: routing.yml