mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-03 21:34:59 +00:00
DX: type-hing oneToMany and ManyToMany properties as collection
This commit is contained in:
@@ -11,6 +11,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Entity;
|
||||
|
||||
use Chill\CalendarBundle\Entity\Calendar;
|
||||
use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;
|
||||
use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface;
|
||||
use Chill\MainBundle\Entity\Address;
|
||||
@@ -43,6 +44,7 @@ use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\Common\Collections\Criteria;
|
||||
use Doctrine\Common\Collections\ReadableCollection;
|
||||
use Doctrine\Common\Collections\Selectable;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Iterator;
|
||||
use LogicException;
|
||||
@@ -150,13 +152,12 @@ class AccompanyingPeriod implements
|
||||
private ?Location $administrativeLocation = null;
|
||||
|
||||
/**
|
||||
* @var Collection&Selectable<int, Calendar>
|
||||
* @ORM\OneToMany(targetEntity="Chill\CalendarBundle\Entity\Calendar", mappedBy="accompanyingPeriod")
|
||||
*/
|
||||
private Collection $calendars;
|
||||
private Collection&Selectable $calendars;
|
||||
|
||||
/**
|
||||
* @var DateTime
|
||||
*
|
||||
* @ORM\Column(type="date", nullable=true)
|
||||
* @Groups({"read", "write", "docgen:read"})
|
||||
* @Assert\NotBlank(groups={AccompanyingPeriod::STEP_CLOSED})
|
||||
@@ -242,6 +243,7 @@ class AccompanyingPeriod implements
|
||||
private ?UserJob $job = null;
|
||||
|
||||
/**
|
||||
* @var Collection<AccompanyingPeriodLocationHistory>
|
||||
* @ORM\OneToMany(targetEntity=AccompanyingPeriodLocationHistory::class,
|
||||
* mappedBy="period", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
*/
|
||||
@@ -320,6 +322,7 @@ class AccompanyingPeriod implements
|
||||
private ?ThirdParty $requestorThirdParty = null;
|
||||
|
||||
/**
|
||||
* @var Collection<Resource>
|
||||
* @ORM\OneToMany(
|
||||
* targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod\Resource",
|
||||
* mappedBy="accompanyingPeriod",
|
||||
@@ -332,6 +335,7 @@ class AccompanyingPeriod implements
|
||||
private Collection $resources;
|
||||
|
||||
/**
|
||||
* @var Collection<Scope>
|
||||
* @ORM\ManyToMany(
|
||||
* targetEntity=Scope::class,
|
||||
* cascade={}
|
||||
@@ -347,6 +351,7 @@ class AccompanyingPeriod implements
|
||||
private Collection $scopes;
|
||||
|
||||
/**
|
||||
* @var Collection<SocialIssue>
|
||||
* @ORM\ManyToMany(
|
||||
* targetEntity=SocialIssue::class
|
||||
* )
|
||||
@@ -366,6 +371,7 @@ class AccompanyingPeriod implements
|
||||
private string $step = self::STEP_DRAFT;
|
||||
|
||||
/**
|
||||
* @var Collection<AccompanyingPeriodStepHistory>
|
||||
* @ORM\OneToMany(targetEntity=AccompanyingPeriodStepHistory::class,
|
||||
* mappedBy="period", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
*/
|
||||
@@ -394,7 +400,7 @@ class AccompanyingPeriod implements
|
||||
* @ORM\OneToMany(targetEntity=UserHistory::class, mappedBy="accompanyingPeriod", orphanRemoval=true,
|
||||
* cascade={"persist", "remove"})
|
||||
*
|
||||
* @var Collection|UserHistory[]
|
||||
* @var Collection<UserHistory>
|
||||
*/
|
||||
private Collection $userHistories;
|
||||
|
||||
@@ -408,6 +414,7 @@ class AccompanyingPeriod implements
|
||||
private ?User $userPrevious = null;
|
||||
|
||||
/**
|
||||
* @var Collection<AccompanyingPeriodWork>
|
||||
* @ORM\OneToMany(
|
||||
* targetEntity=AccompanyingPeriodWork::class,
|
||||
* mappedBy="accompanyingPeriod"
|
||||
@@ -812,7 +819,7 @@ class AccompanyingPeriod implements
|
||||
return 'none';
|
||||
}
|
||||
|
||||
public function getNextCalendarsForPerson(Person $person, $limit = 5): Collection
|
||||
public function getNextCalendarsForPerson(Person $person, $limit = 5): ReadableCollection
|
||||
{
|
||||
$today = new DateTimeImmutable('today');
|
||||
$criteria = Criteria::create()
|
||||
|
Reference in New Issue
Block a user