With this application that I am creating, I want the user to be able to watch recordings from previous years. Therefore, if this user has records related to 2005, I want to be able to display a list of years since then, including this year, for example:
List of years: 2012 | 2011 | 2010 | 2009 | 2008 | 2007 | 2006 | 2005
I developed SQL to retrieve the oldest record from the database, which looks like this:
// Retrieve Oldest Record $minimumyear = $dm->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' )->setParameter('centre', $centreid); $minyear = $minimumyear->getResult();
My problem is that now I have the oldest year, I'm not sure how I can use Twig to display the list that I need. I thought about extending Twig to allow this, but I donβt want to go down this prospectus, so far there is just a feature in Twig that would allow me to do this.
How can I display the list I need using Twig?
symfony twig
mickburkejnr
source share