title: Why does the list of categories is not printing in the twig?
body: <p>I'm trying to list all categories in my homepage twig with the following lines of code:</p>
  
  <pre><code>    {% extends 'base.html.twig' %}
  
  {% block body %}
      &lt;!-- Page Content --&gt;
      &lt;div class="container"&gt;
  
          &lt;div class="row"&gt;
  
              &lt;div class="col-md-3"&gt;
                  &lt;p class="lead"&gt;Categories&lt;/p&gt;
                  &lt;div class="list-group"&gt;
                      {% for category in categories %}
                          &lt;a href="#" class="list-group-item"&gt;{{ category.name }}&lt;/a&gt;
                      {% endfor %}
                  &lt;/div&gt;
              &lt;/div&gt;
  
              &lt;div class="col-md-9"&gt;
  
                  &lt;div class="row carousel-holder"&gt;
  
                      &lt;div class="col-md-12"&gt;
                          &lt;div id="carousel-example-generic" class="carousel slide" data-ride="carousel"&gt;
                              &lt;ol class="carousel-indicators"&gt;
                                  &lt;li data-target="#carousel-example-generic" data-slide-to="0" class="active"&gt;&lt;/li&gt;
                                  &lt;li data-target="#carousel-example-generic" data-slide-to="1"&gt;&lt;/li&gt;
                                  &lt;li data-target="#carousel-example-generic" data-slide-to="2"&gt;&lt;/li&gt;
                              &lt;/ol&gt;
                              &lt;div class="carousel-inner"&gt;
                                  &lt;div class="item active"&gt;
                                      &lt;img class="slide-image" src="https://files.illinoispolicy.org/wp-content/uploads/2016/09/Garbage-Politicians-Jesse-White-800x300.png" alt=""&gt;
                                  &lt;/div&gt;
                                  &lt;div class="item"&gt;
                                      &lt;img class="slide-image" src="https://files.illinoispolicy.org/wp-content/uploads/2016/07/garbage-politicians-michael-madigan-800x300.png" alt=""&gt;
                                  &lt;/div&gt;
                                  &lt;div class="item"&gt;
                                      &lt;img class="slide-image" src="https://files.illinoispolicy.org/wp-content/uploads/2015/03/lion-meat-act-2-800x300.jpg" alt=""&gt;
                                  &lt;/div&gt;
                              &lt;/div&gt;
                              &lt;a class="left carousel-control" href="#carousel-example-generic" data-slide="prev"&gt;
                                  &lt;span class="glyphicon glyphicon-chevron-left"&gt;&lt;/span&gt;
                              &lt;/a&gt;
                              &lt;a class="right carousel-control" href="#carousel-example-generic" data-slide="next"&gt;
                                  &lt;span class="glyphicon glyphicon-chevron-right"&gt;&lt;/span&gt;
                              &lt;/a&gt;
                          &lt;/div&gt;
                          &lt;br&gt;
                      &lt;/div&gt;
  
                  &lt;/div&gt;
  
                  &lt;div class="row"&gt;
  
                      &lt;div class="col-sm-4 col-lg-4 col-md-4"&gt;
                          &lt;div class="thumbnail"&gt;
                              &lt;img src="http://placehold.it/320x150" alt=""&gt;
                              &lt;div class="caption"&gt;
                                  &lt;h4 class="pull-right"&gt;$24.99&lt;/h4&gt;
                                  &lt;h4&gt;&lt;a href="#"&gt;First Product&lt;/a&gt;
                                  &lt;/h4&gt;
                                  &lt;p&gt;See more snippets like this online store item at &lt;a target="_blank" href="http://www.bootsnipp.com"&gt;Bootsnipp - http://bootsnipp.com&lt;/a&gt;.&lt;/p&gt;
                              &lt;/div&gt;
                              &lt;div class="ratings"&gt;
                                  &lt;p class="pull-right"&gt;15 reviews&lt;/p&gt;
                                  &lt;p&gt;
                                      &lt;span class="glyphicon glyphicon-star"&gt;&lt;/span&gt;
                                      &lt;span class="glyphicon glyphicon-star"&gt;&lt;/span&gt;
                                      &lt;span class="glyphicon glyphicon-star"&gt;&lt;/span&gt;
                                      &lt;span class="glyphicon glyphicon-star"&gt;&lt;/span&gt;
                                      &lt;span class="glyphicon glyphicon-star"&gt;&lt;/span&gt;
                                  &lt;/p&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
  
                      &lt;div class="col-sm-4 col-lg-4 col-md-4"&gt;
                          &lt;div class="thumbnail"&gt;
                              &lt;img src="http://placehold.it/320x150" alt=""&gt;
                              &lt;div class="caption"&gt;
                                  &lt;h4 class="pull-right"&gt;$64.99&lt;/h4&gt;
                                  &lt;h4&gt;&lt;a href="#"&gt;Second Product&lt;/a&gt;
                                  &lt;/h4&gt;
                                  &lt;p&gt;This is a short description. Lorem ipsum dolor sit amet, consectetur adipiscing elit.&lt;/p&gt;
                              &lt;/div&gt;
                              &lt;div class="ratings"&gt;
                                  &lt;p class="pull-right"&gt;12 reviews&lt;/p&gt;
                                  &lt;p&gt;
                                      &lt;span class="glyphicon glyphicon-star"&gt;&lt;/span&gt;
                                      &lt;span class="glyphicon glyphicon-star"&gt;&lt;/span&gt;
                                      &lt;span class="glyphicon glyphicon-star"&gt;&lt;/span&gt;
                                      &lt;span class="glyphicon glyphicon-star"&gt;&lt;/span&gt;
                                      &lt;span class="glyphicon glyphicon-star-empty"&gt;&lt;/span&gt;
                                  &lt;/p&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
  
                      &lt;div class="col-sm-4 col-lg-4 col-md-4"&gt;
                          &lt;div class="thumbnail"&gt;
                              &lt;img src="http://placehold.it/320x150" alt=""&gt;
                              &lt;div class="caption"&gt;
                                  &lt;h4 class="pull-right"&gt;$74.99&lt;/h4&gt;
                                  &lt;h4&gt;&lt;a href="#"&gt;Third Product&lt;/a&gt;
                                  &lt;/h4&gt;
                                  &lt;p&gt;This is a short description. Lorem ipsum dolor sit amet, consectetur adipiscing elit.&lt;/p&gt;
                              &lt;/div&gt;
                              &lt;div class="ratings"&gt;
                                  &lt;p class="pull-right"&gt;31 reviews&lt;/p&gt;
                                  &lt;p&gt;
                                      &lt;span class="glyphicon glyphicon-star"&gt;&lt;/span&gt;
                                      &lt;span class="glyphicon glyphicon-star"&gt;&lt;/span&gt;
                                      &lt;span class="glyphicon glyphicon-star"&gt;&lt;/span&gt;
                                      &lt;span class="glyphicon glyphicon-star"&gt;&lt;/span&gt;
                                      &lt;span class="glyphicon glyphicon-star-empty"&gt;&lt;/span&gt;
                                  &lt;/p&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
  
              &lt;/div&gt;
  
          &lt;/div&gt;
  
      &lt;/div&gt;
  {% endblock %}
  </code></pre>
  
  <p>Here is the function in my controller:</p>
  
  <pre><code>public function listCategoriesAction()
  {
      $em = $this-&gt;getDoctrine()-&gt;getManager();
      $categoryRepository = $em-&gt;getRepository('AppBundle:Category');
      $categories = $categoryRepository-&gt;findAll();
  
     return $this-&gt;render('homepage/homepage.html.twig', array(
         'categories' =&gt; $categories
     ));
  }
  </code></pre>
  
  <p>It tells me that the variable category does not exist. I think it's because i'm trying to list many functions from different controllers in 1 twig, but i'm not sure  how to solve it.
  Here is the Route above the function. I used it for the second time, is that the problem ?</p>
  
  <pre><code>  /**
       * @Route("/home", name="homepage")
       * @return \Symfony\Component\HttpFoundation\Response
       */
  </code></pre>