title: "usort" a Doctrine\Common\Collections\ArrayCollection?
body: <p>In various cases I need to sort a <code>Doctrine\Common\Collections\ArrayCollection</code> according to a property in the object. Without finding a method doing that right away, I do this:</p>
  
  <pre><code>// $collection instanceof Doctrine\Common\Collections\ArrayCollection
  $array = $collection-&gt;getValues();
  usort($array, function($a, $b){
      return ($a-&gt;getProperty() &lt; $b-&gt;getProperty()) ? -1 : 1 ;
  });
  
  $collection-&gt;clear();
  foreach ($array as $item) {
      $collection-&gt;add($item);
  }
  </code></pre>
  
  <p>I presume this is not the best way when you have to copy everything to native PHP array and back. I wonder if there is a better way to "usort" a <code>Doctrine\Common\Collections\ArrayCollection</code>. Do I miss any doc?</p>