diff --git a/Entity/Event.php b/Entity/Event.php index 87cc9bab1..acafc5ae3 100644 --- a/Entity/Event.php +++ b/Entity/Event.php @@ -4,7 +4,6 @@ namespace Chill\EventBundle\Entity; use Chill\MainBundle\Entity\HasCenterInterface; use Chill\MainBundle\Entity\HasScopeInterface; -use Doctrine\ORM\Mapping as ORM; /** * Event @@ -215,11 +214,28 @@ class Event implements HasCenterInterface, HasScopeInterface /** * Get participations * - * @return \Doctrine\Common\Collections\Collection + * @return \ArrayIterator|\Doctrine\Common\Collections\Collection|\Traversable */ public function getParticipations() { - return $this->participations; + return $this->getParticipationsOrdered(); + } + + /** + * Sort Collection of Participations + * + * @return \ArrayIterator|\Traversable + */ + public function getParticipationsOrdered() { + + $iterator = $this->participations->getIterator(); + + $iterator->uasort(function($first, $second) + { + return strnatcasecmp($first->getPerson()->getFirstName(), $second->getPerson()->getFirstName()); + }); + + return $iterator; } /**