DX: type-hing oneToMany and ManyToMany properties as collection

This commit is contained in:
2023-07-19 16:21:17 +02:00
parent 224c2c74e8
commit 075aca493b
32 changed files with 130 additions and 73 deletions

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")
*/