title: Symfony/Doctrine - createQueryBuilder orderBy
body: <p>I have a 'Team' Entity with a property 'budget'. I just want to print the teams properties and i want that the team with the biggest budget appear in first position, the second, the third... (DESC).</p>
  
  <p>But with this code, it does not work and i don't understand why.</p>
  
  <p><strong>indexAction</strong> (controller)</p>
  
  <pre><code>    $em = $this-&gt;getDoctrine()-&gt;getManager();
      $teams = $em-&gt;getRepository('FootballBundle:Team')-&gt;getAllTeamsSortedByDescBudget();
  
  
      return $this-&gt;render('FootballBundle:Default:index.html.twig', array(
          'teams' =&gt; $teams,
      ));
  </code></pre>
  
  <p><strong>TeamRepository</strong> </p>
  
  <pre><code>public function getAllTeamsSortedByDescBudget()
  {
      $q = $this-&gt;createQueryBuilder('a');
      $q-&gt;select()-&gt;from('FootballBundle:Team', 't')-&gt;orderBy('t.budget', 'DESC');
  
      return $q-&gt;getQuery()-&gt;getResult();
  }
  </code></pre>
  
  <p><strong>twig view</strong> </p>
  
  <pre><code>&lt;h1&gt;Teams list&lt;/h1&gt;
  &lt;ul&gt;
      {% for team in teams  %}
          &lt;li&gt;{{ team.name }} - {{ team.championship }} - {{ team.budget|number_format(2, '.', ',') }}£&lt;/li&gt;
      {% endfor  %}
      &lt;br/&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p><strong>Team.php</strong> entity</p>
  
  <pre><code>/**
   * @var integer
   *
   * @ORM\Column(name="budget", type="integer")
   */
  private $budget;
  </code></pre>
  
  <p>And here, the result ...</p>
  
  <pre><code>Teams list
  
  Manchester City FC - Premier League - 100,000,000.00£
  Arsenal FC - Premier League - 50,000,000.00£
  Leicester City - Premier League - 20,000,000.00£
  Crystal Palace FC - Premier League - 5,000,000.00£
  Chelsea FC - Premier League - 100,000,000.00£
  </code></pre>
  
  <p>Chelsea... lol</p>
  
  <p><strong>EDIT</strong> : CORRECTED ! See the <em>takeit</em> comment.</p>