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

@@ -83,10 +83,10 @@ class User implements UserInterface, \Stringable, PasswordAuthenticatedUserInter
private ?Location $mainLocation = null;
/**
* @var ArrayCollection<int, UserScopeHistory>
* @var \Doctrine\Common\Collections\Collection<int, \Chill\MainBundle\Entity\User\UserScopeHistory>&Selectable
*/
#[ORM\OneToMany(mappedBy: 'user', targetEntity: UserScopeHistory::class, cascade: ['persist', 'remove'], orphanRemoval: true)]
private ArrayCollection $scopeHistories;
private Collection&Selectable $scopeHistories;
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255)]
private string $password = '';
@@ -98,10 +98,10 @@ class User implements UserInterface, \Stringable, PasswordAuthenticatedUserInter
private ?string $salt = null;
/**
* @var ArrayCollection<int, UserJobHistory>
* @var \Doctrine\Common\Collections\Collection<int, \Chill\MainBundle\Entity\User\UserJobHistory>&Selectable
*/
#[ORM\OneToMany(mappedBy: 'user', targetEntity: UserJobHistory::class, cascade: ['persist', 'remove'], orphanRemoval: true)]
private ArrayCollection $jobHistories;
private Collection&Selectable $jobHistories;
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 80)]
private string $username = '';

View File

@@ -21,7 +21,6 @@ use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\Order;
use Doctrine\ORM\Mapping as ORM;
use Exception;
use Symfony\Component\Serializer\Annotation as Serializer;
use Symfony\Component\Validator\Constraints as Assert;
@@ -278,7 +277,7 @@ class EntityWorkflow implements TrackCreationInterface, TrackUpdateInterface
}
/**
* @throws Exception
* @throws \Exception
*/
public function getStepsChained(): array
{