Replace ArrayCollection with Collection&Selectable on some entity typing (fix previous commit)

Updated entity properties to use Collection&Selectable for better type safety and interoperability. This change affects User, Household, Calendar, Person, AccompanyingPeriod, and EntityWorkflow classes.
This commit is contained in:
2024-08-28 12:04:43 +02:00
parent c16219dc6d
commit b0485dbcc8
6 changed files with 22 additions and 19 deletions

View File

@@ -135,10 +135,10 @@ class AccompanyingPeriod implements
private ?Location $administrativeLocation = null;
/**
* @var ArrayCollection<int, Calendar>
* @var \Doctrine\Common\Collections\Collection<int, \Chill\CalendarBundle\Entity\Calendar>&Selectable
*/
#[ORM\OneToMany(mappedBy: 'accompanyingPeriod', targetEntity: Calendar::class)]
private ArrayCollection $calendars;
private Collection&Selectable $calendars;
#[Groups(['read', 'write', 'docgen:read'])]
#[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_CLOSED])]
@@ -153,7 +153,7 @@ class AccompanyingPeriod implements
private ?ClosingMotive $closingMotive = null;
/**
* @var Collection<(int|string), Comment>
* @var \Doctrine\Common\Collections\Collection<int, \Chill\PersonBundle\Entity\AccompanyingPeriod\Comment>
*/
#[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_DRAFT])]
#[ORM\OneToMany(mappedBy: 'accompanyingPeriod', targetEntity: Comment::class, cascade: ['persist', 'remove'], orphanRemoval: true)]
@@ -246,7 +246,7 @@ class AccompanyingPeriod implements
private ?ThirdParty $requestorThirdParty = null;
/**
* @var Collection<int, Resource>
* @var Collection<int, AccompanyingPeriod\Resource>
*/
#[Groups(['read', 'docgen:read'])]
#[ORM\OneToMany(targetEntity: AccompanyingPeriod\Resource::class, mappedBy: 'accompanyingPeriod', cascade: ['persist', 'remove'], orphanRemoval: true)]
@@ -427,7 +427,7 @@ class AccompanyingPeriod implements
return $this;
}
public function addResource(Resource $resource): self
public function addResource(AccompanyingPeriod\Resource $resource): self
{
$resource->setAccompanyingPeriod($this);
$this->resources[] = $resource;
@@ -592,7 +592,7 @@ class AccompanyingPeriod implements
}
/**
* @return ReadableCollection<(int|string), Comment>
* @return ReadableCollection<int, Comment>
*/
#[Groups(['read'])]
public function getComments(): ReadableCollection
@@ -897,6 +897,9 @@ class AccompanyingPeriod implements
return $this->requestorThirdParty;
}
/**
* @return Collection<int, AccompanyingPeriod\Resource>
*/
public function getResources(): Collection
{
return $this->resources;