mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-28 18:43:49 +00:00
DX: type-hing oneToMany and ManyToMany properties as collection
This commit is contained in:
@@ -72,12 +72,12 @@ class Event implements HasCenterInterface, HasScopeInterface
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @var Participation
|
||||
* @var Collection<Participation>
|
||||
* @ORM\OneToMany(
|
||||
* targetEntity="Chill\EventBundle\Entity\Participation",
|
||||
* mappedBy="event")
|
||||
*/
|
||||
private $participations;
|
||||
private Collection $participations;
|
||||
|
||||
/**
|
||||
* @var EventType
|
||||
@@ -174,11 +174,11 @@ class Event implements HasCenterInterface, HasScopeInterface
|
||||
*/
|
||||
public function getParticipationsOrdered(): \ArrayIterator|\Traversable
|
||||
{
|
||||
$iterator = $this->participations->getIterator();
|
||||
$iterator = iterator_to_array($this->participations->getIterator());
|
||||
|
||||
$iterator->uasort(static fn ($first, $second) => strnatcasecmp($first->getPerson()->getFirstName(), $second->getPerson()->getFirstName()));
|
||||
uasort($iterator, static fn ($first, $second) => strnatcasecmp($first->getPerson()->getFirstName(), $second->getPerson()->getFirstName()));
|
||||
|
||||
return $iterator;
|
||||
return new ArrayIterator($iterator);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user