Doctrine třídění collection
Upozornění: Tohle vlákno je hodně staré a informace nemusí být platné pro současné Nette.

- pitr82
 - Člen | 121
 
Dá se jednoduše setřídit Collection (M:N), kdyuž jí procházím cyklem ?
Já používám toto:
$iterator = $item->actions->getIterator();
		$iterator->uasort(function ($a, $b) {
		    return ($a->getName() < $b->getName()) ? -1 : 1;
		});
		$collection = new \Doctrine\Common\Collections\ArrayCollection(iterator_to_array($iterator));
		foreach ($collection as $action) {
		    $poleOut[] = $action->name;
		}