title: How to display a list of years since a specific year using Twig and Symfony2
body: <p>With this application I'm building I want the user to be able to look at records from previous years. So if that user has records dating back to 2005, I want to be able to display a list of years since then including that year, for example:</p>
  
  <blockquote>
    <p>List of years: 2012 | 2011 | 2010 | 2009 | 2008 | 2007 | 2006 | 2005</p>
  </blockquote>
  
  <p>I've worked out the SQL to retrieve the oldest record from the database, which is as follows:</p>
  
  <pre><code>    // Retrieve Oldest Record
      $minimumyear = $dm-&gt;createQuery('
      SELECT min(msu.endDate) as msuMin
      FROM InstructorBundle:MapSubscriptions msu 
      LEFT JOIN InstructorBundle:MapContacts mc WHERE msu.contact = mc.id
      LEFT JOIN InstructorBundle:MapFamilies mf WHERE mc.family = mf.id
      WHERE mf.branch = :centre'
      )-&gt;setParameter('centre', $centreid);
  
      $minyear = $minimumyear-&gt;getResult();
  </code></pre>
  
  <p>The problem I have is that now I've got the oldest year, I'm not sure how I can use Twig to display the list I need. I have thought about extending Twig to allow this, but I don't want to go down that avenue for the time being just incase there is a function in Twig that would allow me to do this.</p>
  
  <p>How can I display the list I need using Twig?</p>