title: Twig sort array of objects by field
body: <p>I have entity with fields:</p>
  
  <p><strong>User</strong></p>
  
  <ul>
  <li>name </li>
  <li>lastname </li>
  <li>age</li>
  </ul>
  
  <p>and few more. Im sending to Twig array with objects user.</p>
  
  <p>In twig display users in table:</p>
  
  <pre><code> {% for user in users %}
       &lt;td&gt;{{ user.name }}&lt;td&gt; &lt;td&gt;{{ user.lastname}}&lt;td&gt; &lt;td&gt;{{ user.age}}&lt;td&gt;
   {% endfor %}
  </code></pre>
  
  <p>How can I sort users via name or lastname etc. in Twig. I want to create sortable table.</p>