mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-24 11:06:14 +00:00
Sort collection of participations by firstname in Event entity
This commit is contained in:
parent
7ac7def366
commit
8275715b56
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user