Skip to content

Instantly share code, notes, and snippets.

@AhmedSamy
Created April 30, 2015 21:45
Show Gist options
  • Save AhmedSamy/795bcf2be02c43cb4a01 to your computer and use it in GitHub Desktop.
Save AhmedSamy/795bcf2be02c43cb4a01 to your computer and use it in GitHub Desktop.
/**
* @MongoDB\PreFlush
* @return ArrayCollection
*/
public function orderSteps()
{
//workaround to sort steps collection
$iterator = $this->steps->getIterator();
$iterator->uasort(
function ($a, $b) {
return ($a->getOrder() < $b->getOrder()) ? -1 : 1;
}
);
$this->steps = new ArrayCollection(iterator_to_array($iterator));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment