DX: type-hing oneToMany and ManyToMany properties as collection

This commit is contained in:
Julien Fastré 2023-07-19 16:21:17 +02:00
parent 224c2c74e8
commit 075aca493b
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB
32 changed files with 130 additions and 73 deletions

View File

@ -104,6 +104,7 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
/**
* @ORM\ManyToMany(targetEntity="Chill\DocStoreBundle\Entity\StoredObject", cascade={"persist"})
* @Assert\Valid(traverse=true)
* @var Collection<StoredObject>
*/
private Collection $documents;
@ -140,8 +141,9 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
/**
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\Person")
* @Groups({"read", "docgen:read"})
* @var Collection<Person>
*/
private ?Collection $persons = null;
private Collection $persons;
/**
* @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable", columnPrefix="privateComment_")
@ -151,6 +153,7 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
/**
* @ORM\ManyToMany(targetEntity="Chill\ActivityBundle\Entity\ActivityReason")
* @Groups({"docgen:read"})
* @var Collection<ActivityReason>
*/
private Collection $reasons;
@ -170,6 +173,7 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\SocialWork\SocialAction")
* @ORM\JoinTable(name="chill_activity_activity_chill_person_socialaction")
* @Groups({"read", "docgen:read"})
* @var Collection<SocialAction>
*/
private Collection $socialActions;
@ -177,14 +181,16 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\SocialWork\SocialIssue")
* @ORM\JoinTable(name="chill_activity_activity_chill_person_socialissue")
* @Groups({"read", "docgen:read"})
* @var Collection<SocialIssue>
*/
private Collection $socialIssues;
/**
* @ORM\ManyToMany(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty")
* @Groups({"read", "docgen:read"})
* @var Collection<ThirdParty>
*/
private ?Collection $thirdParties = null;
private Collection $thirdParties;
/**
* @ORM\Column(type="time", nullable=true)
@ -200,8 +206,9 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
/**
* @ORM\ManyToMany(targetEntity="Chill\MainBundle\Entity\User")
* @Groups({"read", "docgen:read"})
* @var Collection<User>
*/
private ?Collection $users = null;
private Collection $users;
public function __construct()
{

View File

@ -12,6 +12,7 @@ declare(strict_types=1);
namespace Chill\ActivityBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
@ -47,12 +48,12 @@ class ActivityReasonCategory implements \Stringable
/**
* Array of ActivityReason.
*
* @var ArrayCollection
* @var Collection<ActivityReason>
* @ORM\OneToMany(
* targetEntity="Chill\ActivityBundle\Entity\ActivityReason",
* mappedBy="category")
*/
private $reasons;
private Collection $reasons;
/**
* ActivityReasonCategory constructor.

View File

@ -25,8 +25,9 @@ class AsideActivityCategory
{
/**
* @ORM\OneToMany(targetEntity=AsideActivityCategory::class, mappedBy="parent")
* @var Collection<AsideActivityCategory>
*/
private $children;
private Collection $children;
/**
* @ORM\Id
@ -36,7 +37,6 @@ class AsideActivityCategory
private int $id;
/**
* @ORM\OneToMany(targetEntity=AsideActivityCategory::class, mappedBy="parent")
* @ORM\Column(type="boolean")
*/
private bool $isActive = true;

View File

@ -30,6 +30,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 LogicException;
use Symfony\Component\Serializer\Annotation as Serializer;
@ -125,7 +126,7 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente
private int $dateTimeVersion = 0;
/**
* @var Collection<CalendarDoc::class>
* @var Collection<CalendarDoc>
* @ORM\OneToMany(targetEntity=CalendarDoc::class, mappedBy="calendar", orphanRemoval=true)
*/
private Collection $documents;
@ -154,8 +155,9 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente
* )
* @ORM\JoinTable(name="chill_calendar.calendar_to_invites")
* @Serializer\Groups({"read", "docgen:read"})
* @var Collection&Selectable<int, Invite>
*/
private Collection $invites;
private Collection&Selectable $invites;
/**
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Location")
@ -184,6 +186,7 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente
* @Serializer\Groups({"calendar:read", "read", "calendar:light", "docgen:read"})
* @Serializer\Context(normalizationContext={"read"}, groups={"calendar:light"})
* @Assert\Count(min=1, minMessage="calendar.At least {{ limit }} person is required.")
* @var Collection<Person>
*/
private Collection $persons;
@ -194,6 +197,7 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente
private PrivateCommentEmbeddable $privateComment;
/**
* @var Collection<ThirdParty>
* @ORM\ManyToMany(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty")
* @ORM\JoinTable(name="chill_calendar.calendar_to_thirdparties")
* @Serializer\Groups({"calendar:read", "read", "calendar:light", "docgen:read"})

View File

@ -28,12 +28,12 @@ class Option
private $active = true;
/**
* @var Collection
* @var Collection<Option>
* @ORM\OneToMany(
* targetEntity="Chill\CustomFieldsBundle\Entity\CustomFieldLongChoice\Option",
* mappedBy="parent")
*/
private $children;
private Collection $children;
/**
* @var int

View File

@ -35,14 +35,13 @@ class CustomFieldsGroup
* The custom fields of the group.
* The custom fields are asc-ordered regarding to their property "ordering".
*
* @var Collection
*
* @var Collection<CustomField>
* @ORM\OneToMany(
* targetEntity="Chill\CustomFieldsBundle\Entity\CustomField",
* mappedBy="customFieldGroup")
* @ORM\OrderBy({"ordering": "ASC"})
*/
private $customFields;
private Collection $customFields;
/**
* @var string

View File

@ -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);
}
/**

View File

@ -46,20 +46,20 @@ class EventType
private $name;
/**
* @var Collection
* @var Collection<Role>
* @ORM\OneToMany(
* targetEntity="Chill\EventBundle\Entity\Role",
* mappedBy="type")
*/
private $roles;
private Collection $roles;
/**
* @var Collection
* @var Collection<Status>
* @ORM\OneToMany(
* targetEntity="Chill\EventBundle\Entity\Status",
* mappedBy="type")
*/
private $statuses;
private Collection $statuses;
/**
* Constructor.

View File

@ -110,7 +110,7 @@ class Address implements TrackCreationInterface, TrackUpdateInterface
* This list is computed by a materialized view. It won't be populated until a refresh is done
* on the materialized view.
*
* @var Collection<int, GeographicalUnit>|GeographicalUnit[]
* @var Collection<GeographicalUnit>
* @readonly
* @ORM\ManyToMany(targetEntity=GeographicalUnit::class)
* @ORM\JoinTable(

View File

@ -23,14 +23,14 @@ use Symfony\Component\Serializer\Annotation as Serializer;
class Center implements HasCenterInterface, \Stringable
{
/**
* @var Collection
* @var Collection<GroupCenter>
*
* @ORM\OneToMany(
* targetEntity="Chill\MainBundle\Entity\GroupCenter",
* mappedBy="center"
* )
*/
private $groupCenters;
private Collection $groupCenters;
/**
* @var int

View File

@ -45,6 +45,7 @@ class GeographicalUnitLayer
private string $refId = '';
/**
* @var Collection<GeographicalUnit>
* @ORM\OneToMany(targetEntity=GeographicalUnit::class, mappedBy="layer")
*/
private Collection $units;

View File

@ -42,6 +42,7 @@ class Notification implements TrackUpdateInterface
private array $addedAddresses = [];
/**
* @var Collection<User>
* @ORM\ManyToMany(targetEntity=User::class)
* @ORM\JoinTable(name="chill_main_notification_addresses_user")
*/
@ -65,6 +66,7 @@ class Notification implements TrackUpdateInterface
private ?ArrayCollection $addressesOnLoad = null;
/**
* @var Collection<NotificationComment>
* @ORM\OneToMany(targetEntity=NotificationComment::class, mappedBy="notification", orphanRemoval=true)
* @ORM\OrderBy({"createdAt": "ASC"})
*/
@ -112,6 +114,7 @@ class Notification implements TrackUpdateInterface
private string $title = '';
/**
* @var Collection<User>
* @ORM\ManyToMany(targetEntity=User::class)
* @ORM\JoinTable(name="chill_main_notification_addresses_unread")
*/

View File

@ -32,14 +32,13 @@ class PermissionsGroup
private $flags = [];
/**
* @var Collection
*
* @var Collection<GroupCenter>
* @ORM\OneToMany(
* targetEntity="Chill\MainBundle\Entity\GroupCenter",
* mappedBy="permissionsGroup"
* )
*/
private $groupCenters;
private Collection $groupCenters;
/**
* @var int
@ -58,15 +57,14 @@ class PermissionsGroup
private $name;
/**
* @var Collection
*
* @var Collection<RoleScope>
* @ORM\ManyToMany(
* targetEntity="Chill\MainBundle\Entity\RoleScope",
* inversedBy="permissionsGroups",
* cascade={ "persist" })
* @ORM\Cache(usage="NONSTRICT_READ_WRITE")
*/
private $roleScopes;
private Collection $roleScopes;
/**
* PermissionsGroup constructor.

View File

@ -30,13 +30,13 @@ class RoleScope
private ?int $id = null;
/**
* @var Collection
* @var Collection<PermissionsGroup>
*
* @ORM\ManyToMany(
* targetEntity="Chill\MainBundle\Entity\PermissionsGroup",
* mappedBy="roleScopes")
*/
private $permissionsGroups;
private Collection $permissionsGroups;
/**
* @ORM\Column(type="string", length=255)

View File

@ -51,14 +51,14 @@ class Scope
private array $name = [];
/**
* @var Collection
* @var Collection<RoleScope>
*
* @ORM\OneToMany(
* targetEntity="Chill\MainBundle\Entity\RoleScope",
* mappedBy="scope")
* @ORM\Cache(usage="NONSTRICT_READ_WRITE")
*/
private $roleScopes;
private Collection $roleScopes;
/**
* Scope constructor.

View File

@ -83,6 +83,7 @@ class User implements UserInterface, \Stringable
private bool $enabled = true;
/**
* @var Collection<GroupCenter>
* @ORM\ManyToMany(
* targetEntity="Chill\MainBundle\Entity\GroupCenter",
* inversedBy="users")

View File

@ -75,7 +75,7 @@ class EntityWorkflow implements TrackCreationInterface, TrackUpdateInterface
/**
* @ORM\OneToMany(targetEntity=EntityWorkflowComment::class, mappedBy="entityWorkflow", orphanRemoval=true)
*
* @var Collection|EntityWorkflowComment[]
* @var Collection<EntityWorkflowComment>
*/
private Collection $comments;
@ -100,7 +100,7 @@ class EntityWorkflow implements TrackCreationInterface, TrackUpdateInterface
* @ORM\OneToMany(targetEntity=EntityWorkflowStep::class, mappedBy="entityWorkflow", orphanRemoval=true, cascade={"persist"})
* @ORM\OrderBy({"transitionAt": "ASC", "id": "ASC"})
* @Assert\Valid(traverse=true)
* @var Collection|EntityWorkflowStep[]
* @var Collection<EntityWorkflowStep>
*/
private Collection $steps;
@ -113,7 +113,7 @@ class EntityWorkflow implements TrackCreationInterface, TrackUpdateInterface
* @ORM\ManyToMany(targetEntity=User::class)
* @ORM\JoinTable(name="chill_main_workflow_entity_subscriber_to_final")
*
* @var Collection|User[]
* @var Collection<User>
*/
private Collection $subscriberToFinal;
@ -121,7 +121,7 @@ class EntityWorkflow implements TrackCreationInterface, TrackUpdateInterface
* @ORM\ManyToMany(targetEntity=User::class)
* @ORM\JoinTable(name="chill_main_workflow_entity_subscriber_to_step")
*
* @var Collection|User[]
* @var Collection<User>
*/
private Collection $subscriberToStep;

View File

@ -33,6 +33,7 @@ class EntityWorkflowStep
private string $accessKey;
/**
* @var Collection<User>
* @ORM\ManyToMany(targetEntity=User::class)
* @ORM\JoinTable(name="chill_main_workflow_entity_step_cc_user")
*/
@ -54,12 +55,14 @@ class EntityWorkflowStep
private array $destEmail = [];
/**
* @var Collection<User>
* @ORM\ManyToMany(targetEntity=User::class)
* @ORM\JoinTable(name="chill_main_workflow_entity_step_user")
*/
private Collection $destUser;
/**
* @var Collection<User>
* @ORM\ManyToMany(targetEntity=User::class)
* @ORM\JoinTable(name="chill_main_workflow_entity_step_user_by_accesskey")
*/

View File

@ -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()

View File

@ -102,6 +102,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
private ?DateTimeImmutable $endDate = null;
/**
* @var Collection<AccompanyingPeriodWorkGoal>
* @ORM\OneToMany(
* targetEntity=AccompanyingPeriodWorkGoal::class,
* mappedBy="accompanyingPeriodWork",
@ -137,6 +138,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
private string $note = '';
/**
* @var Collection<Person>
* @ORM\ManyToMany(targetEntity=Person::class)
* @ORM\JoinTable(name="chill_person_accompanying_period_work_person")
* @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"})
@ -152,6 +154,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
private PrivateCommentEmbeddable $privateComment;
/**
* @var Collection<User>
* @ORM\ManyToMany(targetEntity=User::class)
* @ORM\JoinTable(name="chill_person_accompanying_period_work_referrer")
* @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"})
@ -161,6 +164,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
private Collection $referrers;
/**
* @var Collection<Result>
* @ORM\ManyToMany(targetEntity=Result::class, inversedBy="accompanyingPeriodWorks")
* @ORM\JoinTable(name="chill_person_accompanying_period_work_result")
* @Serializer\Groups({"read", "docgen:read"})
@ -185,6 +189,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
private ?DateTimeImmutable $startDate = null;
/**
* @var Collection<ThirdParty>
* @ORM\ManyToMany(targetEntity=ThirdParty::class)
* @ORM\JoinTable(name="chill_person_accompanying_period_work_third_party")
*

View File

@ -59,6 +59,7 @@ class AccompanyingPeriodWorkGoal
private ?string $note = null;
/**
* @var Collection<Result>
* @ORM\ManyToMany(targetEntity=Result::class, inversedBy="accompanyingPeriodWorkGoals")
* @ORM\JoinTable(name="chill_person_accompanying_period_work_goal_result")
* @Serializer\Groups({"accompanying_period_work:edit"})

View File

@ -32,6 +32,7 @@ class ClosingMotive
/**
* Child Accompanying periods.
*
* @var Collection<ClosingMotive>
* @ORM\OneToMany(
* targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive",
* mappedBy="parent")

View File

@ -23,6 +23,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 Symfony\Component\Serializer\Annotation as Serializer;
use Symfony\Component\Validator\Constraints as Assert;
@ -45,6 +46,7 @@ class Household
/**
* Addresses.
*
* @var Collection<Address>
* @ORM\ManyToMany(
* targetEntity="Chill\MainBundle\Entity\Address",
* cascade={"persist", "remove", "merge", "detach"})
@ -60,6 +62,7 @@ class Household
private CommentEmbeddable $commentMembers;
/**
* @var Collection&Selectable<int, HouseholdComposition>
* @ORM\OneToMany(
* targetEntity=HouseholdComposition::class,
* mappedBy="household",
@ -69,7 +72,7 @@ class Household
* @ORM\OrderBy({"startDate": "DESC"})
* @Assert\Valid(traverse=true, groups={"household_composition"})
*/
private Collection $compositions;
private Collection&Selectable $compositions;
/**
* @ORM\Id
@ -80,6 +83,7 @@ class Household
private ?int $id = null;
/**
* @var Collection<HouseholdMember>
* @ORM\OneToMany(
* targetEntity=HouseholdMember::class,
* mappedBy="household"
@ -146,9 +150,9 @@ class Household
*
* @Assert\Callback(methods={"validate"})
*
* @return \Chill\MainBundle\Entity\Address[]
* @return Collection<Address>
*/
public function getAddresses()
public function getAddresses(): Collection
{
return $this->addresses;
}

View File

@ -14,6 +14,7 @@ namespace Chill\PersonBundle\Entity;
use ArrayIterator;
use Chill\BudgetBundle\Entity\Charge;
use Chill\BudgetBundle\Entity\Resource;
use Chill\CalendarBundle\Entity\Calendar;
use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;
use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface;
use Chill\MainBundle\Entity\Address;
@ -22,6 +23,7 @@ use Chill\MainBundle\Entity\Civility;
use Chill\MainBundle\Entity\Country;
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
use Chill\MainBundle\Entity\HasCenterInterface;
use Chill\MainBundle\Entity\Language;
use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Validation\Constraint\PhonenumberConstraint;
use Chill\PersonBundle\Entity\Household\Household;
@ -110,14 +112,14 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
/**
* The person's accompanying periods (when the person was accompanied by the center).
*
* @var Collection
* @var Collection<AccompanyingPeriodParticipation>
*
* @ORM\OneToMany(targetEntity=AccompanyingPeriodParticipation::class,
* mappedBy="person",
* cascade={"persist", "remove", "merge", "detach"})
* @ORM\OrderBy({"startDate": "DESC"})
*/
private $accompanyingPeriodParticipations;
private Collection $accompanyingPeriodParticipations;
/**
* The accompanying period requested by the Person.
@ -125,14 +127,14 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
* @ORM\OneToMany(targetEntity=AccompanyingPeriod::class,
* mappedBy="requestorPerson")
*
* @var AccompanyingPeriod[]|Collection
* @var Collection<AccompanyingPeriod>
*/
private Collection $accompanyingPeriodRequested;
/**
* Addresses.
*
* @var Collection
* @var Collection<Address>
*
* @ORM\ManyToMany(
* targetEntity="Chill\MainBundle\Entity\Address",
@ -140,10 +142,10 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
* @ORM\JoinTable(name="chill_person_persons_to_addresses")
* @ORM\OrderBy({"validFrom": "DESC"})
*/
private $addresses;
private Collection $addresses;
/**
* @var Collection
* @var Collection<PersonAltName>
*
* @ORM\OneToMany(
* targetEntity="Chill\PersonBundle\Entity\PersonAltName",
@ -151,7 +153,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
* cascade={"persist", "remove", "merge", "detach"},
* orphanRemoval=true)
*/
private $altNames;
private Collection $altNames;
/**
* The person's birthdate.
@ -164,6 +166,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
private $birthdate;
/**
* @var Collection<Charge>
* @ORM\OneToMany(
* targetEntity=Charge::class,
* mappedBy="person"
@ -172,6 +175,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
private Collection $budgetCharges;
/**
* @var Collection<Resource>
* @ORM\OneToMany(
* targetEntity=Resource::class,
* mappedBy="person"
@ -180,6 +184,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
private Collection $budgetResources;
/**
* @var Collection<Calendar>
* @ORM\ManyToMany(
* targetEntity="Chill\CalendarBundle\Entity\Calendar",
* mappedBy="persons"
@ -204,7 +209,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
/**
* @ORM\OneToMany(targetEntity=PersonCenterHistory::class, mappedBy="person", cascade={"persist"})
*
* @var Collection|PersonCenterHistory[]
* @var Collection<PersonCenterHistory>
*/
private Collection $centerHistory;
@ -342,6 +347,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
/**
* Read-only field, computed by the database.
*
* @var Collection<PersonHouseholdAddress>
* @ORM\OneToMany(
* targetEntity=PersonHouseholdAddress::class,
* mappedBy="person"
@ -355,7 +361,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
* mappedBy="person"
* )
*
* @var Collection|HouseholdMember[]
* @var Collection<HouseholdMember>
*/
private Collection $householdParticipations;
@ -446,7 +452,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
private ?int $numberOfChildren = null;
/**
* @var Collection
* @var Collection<PersonPhone>
*
* @ORM\OneToMany(
* targetEntity="Chill\PersonBundle\Entity\PersonPhone",
@ -458,13 +464,14 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
* traverse=true,
* )
*/
private $otherPhoneNumbers;
private Collection $otherPhoneNumbers;
/**
* @ORM\OneToMany(
* targetEntity=AccompanyingPeriod::class,
* mappedBy="personLocation"
* )
* @var Collection<AccompanyingPeriod>
*/
private Collection $periodLocatedOn;
@ -499,14 +506,14 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
/**
* @ORM\OneToMany(targetEntity=PersonResource::class, mappedBy="personOwner")
*
* @var Collection|PersonResource[];
* @var Collection<PersonResource>
*/
private Collection $resources;
/**
* The person's spoken languages.
*
* @var ArrayCollection
* @var Collection<Language>
*
* @ORM\ManyToMany(targetEntity="Chill\MainBundle\Entity\Language")
* @ORM\JoinTable(
@ -515,7 +522,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
* inverseJoinColumns={@ORM\JoinColumn(name="language_id", referencedColumnName="id")}
* )
*/
private $spokenLanguages;
private Collection $spokenLanguages;
/**
* @ORM\Column(type="datetime", nullable=true, options={"default": NULL})
@ -1361,7 +1368,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
/**
* Get spokenLanguages.
*
* @return ArrayCollection
* @return Collection<Language>
*/
public function getSpokenLanguages()
{

View File

@ -52,6 +52,7 @@ class Evaluation
private ?DateInterval $notificationDelay = null;
/**
* @var Collection<SocialAction>
* @ORM\ManyToMany(
* targetEntity=SocialAction::class,
* mappedBy="evaluations"

View File

@ -43,12 +43,14 @@ class Goal
private ?int $id = null;
/**
* @var Collection<Result>
* @ORM\ManyToMany(targetEntity=Result::class, inversedBy="goals")
* @ORM\JoinTable(name="chill_person_social_work_goal_result")
*/
private Collection $results;
/**
* @var Collection<SocialAction>
* @ORM\ManyToMany(targetEntity=SocialAction::class, mappedBy="goals")
*/
private Collection $socialActions;

View File

@ -33,11 +33,13 @@ use Symfony\Component\Serializer\Annotation as Serializer;
class Result
{
/**
* @var Collection<AccompanyingPeriodWorkGoal>
* @ORM\ManyToMany(targetEntity=AccompanyingPeriodWorkGoal::class, mappedBy="results")
*/
private Collection $accompanyingPeriodWorkGoals;
/**
* @var Collection<AccompanyingPeriodWork>
* @ORM\ManyToMany(targetEntity=AccompanyingPeriodWork::class, mappedBy="results")
*/
private Collection $accompanyingPeriodWorks;
@ -48,6 +50,7 @@ class Result
private ?DateTime $desactivationDate = null;
/**
* @var Collection<Goal>
* @ORM\ManyToMany(targetEntity=Goal::class, mappedBy="results")
*/
private Collection $goals;
@ -61,6 +64,7 @@ class Result
private ?int $id = null;
/**
* @var Collection<SocialAction>
* @ORM\ManyToMany(targetEntity=SocialAction::class, mappedBy="results")
*/
private Collection $socialActions;

View File

@ -32,9 +32,10 @@ use Symfony\Component\Serializer\Annotation as Serializer;
class SocialAction
{
/**
* @var Collection<SocialAction>
* @ORM\OneToMany(targetEntity=SocialAction::class, mappedBy="parent")
*/
private $children;
private Collection $children;
/**
* @ORM\Column(type="dateinterval", nullable=true)
@ -47,16 +48,18 @@ class SocialAction
private $desactivationDate;
/**
* @var Collection<Evaluation>
* @ORM\ManyToMany(targetEntity=Evaluation::class, inversedBy="socialActions")
* @ORM\JoinTable(name="chill_person_social_work_evaluation_action")
*/
private Collection $evaluations;
/**
* @var Collection<Goal>
* @ORM\ManyToMany(targetEntity=Goal::class, inversedBy="socialActions")
* @ORM\JoinTable(name="chill_person_social_action_goal")
*/
private $goals;
private Collection $goals;
/**
* @ORM\Id
@ -81,10 +84,11 @@ class SocialAction
private $parent;
/**
* @var Collection<Result>
* @ORM\ManyToMany(targetEntity=Result::class, inversedBy="socialActions")
* @ORM\JoinTable(name="chill_person_social_action_result")
*/
private $results;
private Collection $results;
/**
* @ORM\Column(type="json")

View File

@ -28,9 +28,10 @@ use Symfony\Component\Serializer\Annotation\Groups;
class SocialIssue
{
/**
* @var Collection<SocialIssue>
* @ORM\OneToMany(targetEntity=SocialIssue::class, mappedBy="parent")
*/
private $children;
private Collection $children;
/**
* @ORM\Column(type="datetime", nullable=true)
@ -55,9 +56,10 @@ class SocialIssue
private $parent;
/**
* @var Collection<SocialAction>
* @ORM\OneToMany(targetEntity=SocialAction::class, mappedBy="issue")
*/
private $socialActions;
private Collection $socialActions;
/**
* @ORM\Column(type="json")

View File

@ -69,7 +69,7 @@ class RecurringTask extends AbstractTask
private $occurenceWarningInterval;
/**
* @var Collection
* @var Collection<SingleTask>
*
* @ORM\OneToMany(
* targetEntity="SingleTask",

View File

@ -11,6 +11,7 @@ declare(strict_types=1);
namespace Chill\TaskBundle\Entity;
use Chill\TaskBundle\Entity\Task\SingleTaskPlaceEvent;
use DateInterval;
use DateTime;
use DateTimeImmutable;
@ -92,14 +93,14 @@ class SingleTask extends AbstractTask
private $startDate;
/**
* @var \Doctrine\Common\Collections\Collection
* @var Collection<SingleTaskPlaceEvent>
* @ORM\OneToMany(
* targetEntity="\Chill\TaskBundle\Entity\Task\SingleTaskPlaceEvent",
* mappedBy="task",
* cascade={ "remove" }
* )
*/
private $taskPlaceEvents;
private Collection $taskPlaceEvents;
/**
* @var DateInterval

View File

@ -132,7 +132,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin
private ?string $canonicalized = '';
/**
* @var ThirdPartyCategory
* @var Collection<ThirdPartyCategory>
* @ORM\ManyToMany(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdPartyCategory")
* @ORM\JoinTable(name="chill_3party.thirdparty_category",
* joinColumns={@ORM\JoinColumn(name="thirdparty_id", referencedColumnName="id")},
@ -143,6 +143,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin
private Collection $categories;
/**
* @var Collection<Center>
* @ORM\ManyToMany(targetEntity="\Chill\MainBundle\Entity\Center")
* @ORM\JoinTable(name="chill_3party.party_center")
*/
@ -154,7 +155,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin
* @ORM\OneToMany(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty", mappedBy="parent",
* cascade={"persist"}, orphanRemoval=true)
*
* @var Collection<(int|string), ThirdParty>
* @var Collection<ThirdParty>
* @Assert\Valid(traverse=true)
*/
private Collection $children;