title: Sorting in the template, in Symfony2: using Twig to sort a collection of objects by property
body: <p>In a Symfony2 project I have a controller that retrieves a number of incidents from the database. These incidents have properties like start_time, stop_time, type, etc.</p>
  
  <p>In my view, I want to show these incidents in a table, sorted by start_time. I use Twig for my templating.</p>
  
  <p>I can pre-sort in my controller before passing it to the Twig template, but imho the controller shouldn't care that the view wants it sorted. Maybe another template that I create will want it sorted by type, for example.</p>
  
  <p>Now, is there a way that I can give the collection of incident-objects as-is to the Twig template, and have it sort it for me on the spot?
  Maybe with a '| sort' filter, but then with something like a '| property(start_time)' filter in front of it, if you know what I mean :-)</p>
  
  <p>Any advice is welcome, thanks in advance!</p>
  
  <p>Dieter</p>