mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-30 10:29:42 +00:00
Apply rector rules: symfony up to 54
This commit is contained in:
@@ -58,18 +58,14 @@ use UnexpectedValueException;
|
||||
*
|
||||
* @ORM\Table(name="chill_person_accompanying_period")
|
||||
*
|
||||
* @DiscriminatorMap(typeProperty="type", mapping={
|
||||
* "accompanying_period": AccompanyingPeriod::class
|
||||
* })
|
||||
*
|
||||
* @Assert\GroupSequenceProvider
|
||||
*
|
||||
* @AccompanyingPeriodValidity(groups={AccompanyingPeriod::STEP_DRAFT, AccompanyingPeriod::STEP_CONFIRMED})
|
||||
*
|
||||
* @LocationValidity(groups={AccompanyingPeriod::STEP_DRAFT, AccompanyingPeriod::STEP_CONFIRMED})
|
||||
*
|
||||
* @ConfidentialCourseMustHaveReferrer(groups={AccompanyingPeriod::STEP_DRAFT, AccompanyingPeriod::STEP_CONFIRMED})
|
||||
*/
|
||||
#[DiscriminatorMap(typeProperty: 'type', mapping: ['accompanying_period' => AccompanyingPeriod::class])]
|
||||
#[Assert\GroupSequenceProvider]
|
||||
class AccompanyingPeriod implements
|
||||
GroupSequenceProviderInterface,
|
||||
HasCentersInterface,
|
||||
@@ -144,11 +140,9 @@ class AccompanyingPeriod implements
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Location")
|
||||
*
|
||||
* @Groups({"read", "write"})
|
||||
*
|
||||
* @Assert\NotBlank(groups={AccompanyingPeriod::STEP_CONFIRMED})
|
||||
*/
|
||||
#[Groups(['read', 'write'])]
|
||||
#[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_CONFIRMED])]
|
||||
private ?Location $administrativeLocation = null;
|
||||
|
||||
/**
|
||||
@@ -160,17 +154,10 @@ class AccompanyingPeriod implements
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="date", nullable=true)
|
||||
*
|
||||
* @Groups({"read", "write", "docgen:read"})
|
||||
*
|
||||
* @Assert\NotBlank(groups={AccompanyingPeriod::STEP_CLOSED})
|
||||
*
|
||||
* @Assert\GreaterThanOrEqual(
|
||||
* propertyPath="openingDate",
|
||||
* groups={AccompanyingPeriod::STEP_CLOSED},
|
||||
* message="The closing date must be later than the date of creation"
|
||||
* )
|
||||
*/
|
||||
#[Groups(['read', 'write', 'docgen:read'])]
|
||||
#[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_CLOSED])]
|
||||
#[Assert\GreaterThanOrEqual(propertyPath: 'openingDate', groups: [AccompanyingPeriod::STEP_CLOSED], message: 'The closing date must be later than the date of creation')]
|
||||
private ?\DateTime $closingDate = null;
|
||||
|
||||
/**
|
||||
@@ -178,11 +165,9 @@ class AccompanyingPeriod implements
|
||||
* targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive")
|
||||
*
|
||||
* @ORM\JoinColumn(nullable=true)
|
||||
*
|
||||
* @Groups({"read", "write"})
|
||||
*
|
||||
* @Assert\NotBlank(groups={AccompanyingPeriod::STEP_CLOSED})
|
||||
*/
|
||||
#[Groups(['read', 'write'])]
|
||||
#[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_CLOSED])]
|
||||
private ?ClosingMotive $closingMotive = null;
|
||||
|
||||
/**
|
||||
@@ -194,40 +179,35 @@ class AccompanyingPeriod implements
|
||||
*
|
||||
* @ORM\OrderBy({"createdAt": "DESC", "id": "DESC"})
|
||||
*
|
||||
* @Assert\NotBlank(groups={AccompanyingPeriod::STEP_DRAFT})
|
||||
*
|
||||
* @var Collection<Comment>
|
||||
*/
|
||||
#[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_DRAFT])]
|
||||
private Collection $comments;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="boolean", options={"default": false})
|
||||
*
|
||||
* @Groups({"read", "write", "docgen:read"})
|
||||
*/
|
||||
#[Groups(['read', 'write', 'docgen:read'])]
|
||||
private bool $confidential = false;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="datetime", nullable=true, options={"default": NULL})
|
||||
*
|
||||
* @Groups({"docgen:read"})
|
||||
*/
|
||||
#[Groups(['docgen:read'])]
|
||||
private ?\DateTimeInterface $createdAt = null;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=User::class)
|
||||
*
|
||||
* @ORM\JoinColumn(nullable=true)
|
||||
*
|
||||
* @Groups({"read", "docgen:read"})
|
||||
*/
|
||||
#[Groups(['read', 'docgen:read'])]
|
||||
private ?User $createdBy = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="boolean", options={"default": false})
|
||||
*
|
||||
* @Groups({"read", "write", "docgen:read"})
|
||||
*/
|
||||
#[Groups(['read', 'write', 'docgen:read'])]
|
||||
private bool $emergency = false;
|
||||
|
||||
/**
|
||||
@@ -236,29 +216,24 @@ class AccompanyingPeriod implements
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
*
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*
|
||||
* @Groups({"read", "docgen:read"})
|
||||
*/
|
||||
#[Groups(['read', 'docgen:read'])]
|
||||
private ?int $id = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", nullable=true)
|
||||
*
|
||||
* @Groups({"read"})
|
||||
*
|
||||
* @Assert\NotBlank(groups={AccompanyingPeriod::STEP_CONFIRMED})
|
||||
*/
|
||||
#[Groups(['read'])]
|
||||
#[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_CONFIRMED])]
|
||||
private ?string $intensity = self::INTENSITY_OCCASIONAL;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(
|
||||
* targetEntity=UserJob::class
|
||||
* )
|
||||
*
|
||||
* @Groups({"read", "write"})
|
||||
*
|
||||
* @Assert\NotBlank(groups={AccompanyingPeriod::STEP_CONFIRMED})
|
||||
*/
|
||||
#[Groups(['read', 'write'])]
|
||||
#[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_CONFIRMED])]
|
||||
private ?UserJob $job = null;
|
||||
|
||||
/**
|
||||
@@ -271,24 +246,19 @@ class AccompanyingPeriod implements
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="date")
|
||||
*
|
||||
* @Groups({"read", "write", "docgen:read"})
|
||||
*
|
||||
* @Assert\LessThan(value="tomorrow", groups={AccompanyingPeriod::STEP_CONFIRMED})
|
||||
*
|
||||
* @Assert\LessThanOrEqual(propertyPath="closingDate", groups={AccompanyingPeriod::STEP_CONFIRMED})
|
||||
*/
|
||||
#[Groups(['read', 'write', 'docgen:read'])]
|
||||
#[Assert\LessThan(value: 'tomorrow', groups: [AccompanyingPeriod::STEP_CONFIRMED])]
|
||||
#[Assert\LessThanOrEqual(propertyPath: 'closingDate', groups: [AccompanyingPeriod::STEP_CONFIRMED])]
|
||||
private ?\DateTime $openingDate = null;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=Origin::class)
|
||||
*
|
||||
* @ORM\JoinColumn(nullable=true)
|
||||
*
|
||||
* @Groups({"read", "write"})
|
||||
*
|
||||
* @Assert\NotBlank(groups={AccompanyingPeriod::STEP_CONFIRMED})
|
||||
*/
|
||||
#[Groups(['read', 'write'])]
|
||||
#[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_CONFIRMED])]
|
||||
private ?Origin $origin = null;
|
||||
|
||||
/**
|
||||
@@ -296,12 +266,11 @@ class AccompanyingPeriod implements
|
||||
* mappedBy="accompanyingPeriod", orphanRemoval=true,
|
||||
* cascade={"persist", "refresh", "remove", "merge", "detach"})
|
||||
*
|
||||
* @Groups({"read", "docgen:read"})
|
||||
*
|
||||
* @ParticipationOverlap(groups={AccompanyingPeriod::STEP_DRAFT, AccompanyingPeriod::STEP_CONFIRMED})
|
||||
*
|
||||
* @var Collection<AccompanyingPeriodParticipation>
|
||||
*/
|
||||
#[Groups(['read', 'docgen:read'])]
|
||||
private Collection $participations;
|
||||
|
||||
/**
|
||||
@@ -318,26 +287,23 @@ class AccompanyingPeriod implements
|
||||
* cascade={"persist"},
|
||||
* )
|
||||
*
|
||||
* @Groups({"read"})
|
||||
*
|
||||
* @ORM\JoinColumn(onDelete="SET NULL")
|
||||
*/
|
||||
#[Groups(['read'])]
|
||||
private ?Comment $pinnedComment = null;
|
||||
|
||||
private bool $preventUserIsChangedNotification = false;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text")
|
||||
*
|
||||
* @Groups({"read", "write"})
|
||||
*/
|
||||
#[Groups(['read', 'write'])]
|
||||
private string $remark = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="boolean", options={"default": false})
|
||||
*
|
||||
* @Groups({"read", "write", "docgen:read"})
|
||||
*/
|
||||
#[Groups(['read', 'write', 'docgen:read'])]
|
||||
private bool $requestorAnonymous = false;
|
||||
|
||||
/**
|
||||
@@ -364,10 +330,9 @@ class AccompanyingPeriod implements
|
||||
* orphanRemoval=true
|
||||
* )
|
||||
*
|
||||
* @Groups({"read", "docgen:read"})
|
||||
*
|
||||
* @ResourceDuplicateCheck(groups={AccompanyingPeriod::STEP_DRAFT, AccompanyingPeriod::STEP_CONFIRMED, "Default", "default"})
|
||||
*/
|
||||
#[Groups(['read', 'docgen:read'])]
|
||||
private Collection $resources;
|
||||
|
||||
/**
|
||||
@@ -383,11 +348,9 @@ class AccompanyingPeriod implements
|
||||
* joinColumns={@ORM\JoinColumn(name="accompanying_period_id", referencedColumnName="id")},
|
||||
* inverseJoinColumns={@ORM\JoinColumn(name="scope_id", referencedColumnName="id")}
|
||||
* )
|
||||
*
|
||||
* @Groups({"read", "docgen:read"})
|
||||
*
|
||||
* @Assert\Count(min=1, groups={AccompanyingPeriod::STEP_CONFIRMED}, minMessage="A course must be associated to at least one scope")
|
||||
*/
|
||||
#[Groups(['read', 'docgen:read'])]
|
||||
#[Assert\Count(min: 1, groups: [AccompanyingPeriod::STEP_CONFIRMED], minMessage: 'A course must be associated to at least one scope')]
|
||||
private Collection $scopes;
|
||||
|
||||
/**
|
||||
@@ -400,20 +363,17 @@ class AccompanyingPeriod implements
|
||||
* @ORM\JoinTable(
|
||||
* name="chill_person_accompanying_period_social_issues"
|
||||
* )
|
||||
*
|
||||
* @Groups({"read", "docgen:read"})
|
||||
*
|
||||
* @Assert\Count(min=1, groups={AccompanyingPeriod::STEP_CONFIRMED}, minMessage="A course must contains at least one social issue")
|
||||
*/
|
||||
#[Groups(['read', 'docgen:read'])]
|
||||
#[Assert\Count(min: 1, groups: [AccompanyingPeriod::STEP_CONFIRMED], minMessage: 'A course must contains at least one social issue')]
|
||||
private Collection $socialIssues;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=32, nullable=true)
|
||||
*
|
||||
* @Groups({"read"})
|
||||
*
|
||||
* @var AccompanyingPeriod::STEP_*
|
||||
*/
|
||||
#[Groups(['read'])]
|
||||
private ?string $step = self::STEP_DRAFT;
|
||||
|
||||
/**
|
||||
@@ -440,9 +400,8 @@ class AccompanyingPeriod implements
|
||||
* @ORM\ManyToOne(targetEntity=User::class)
|
||||
*
|
||||
* @ORM\JoinColumn(nullable=true)
|
||||
*
|
||||
* @Groups({"read", "write", "docgen:read"})
|
||||
*/
|
||||
#[Groups(['read', 'write', 'docgen:read'])]
|
||||
private ?User $user = null;
|
||||
|
||||
/**
|
||||
@@ -469,9 +428,8 @@ class AccompanyingPeriod implements
|
||||
* targetEntity=AccompanyingPeriodWork::class,
|
||||
* mappedBy="accompanyingPeriod"
|
||||
* )
|
||||
*
|
||||
* @Assert\Valid(traverse=true)
|
||||
*/
|
||||
#[Assert\Valid(traverse: true)]
|
||||
private Collection $works;
|
||||
|
||||
/**
|
||||
@@ -749,10 +707,9 @@ class AccompanyingPeriod implements
|
||||
}
|
||||
|
||||
/**
|
||||
* @Groups({"read"})
|
||||
*
|
||||
* @return ReadableCollection<(int|string), Comment>
|
||||
*/
|
||||
#[Groups(['read'])]
|
||||
public function getComments(): ReadableCollection
|
||||
{
|
||||
$pinnedComment = $this->pinnedComment;
|
||||
@@ -775,9 +732,7 @@ class AccompanyingPeriod implements
|
||||
return $this->createdBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Groups({"docgen:read"})
|
||||
*/
|
||||
#[Groups(['docgen:read'])]
|
||||
public function getCurrentParticipations(): ReadableCollection
|
||||
{
|
||||
return $this->getOpenParticipations();
|
||||
@@ -826,9 +781,8 @@ class AccompanyingPeriod implements
|
||||
|
||||
/**
|
||||
* Get the location, taking precedence into account.
|
||||
*
|
||||
* @Groups({"read"})
|
||||
*/
|
||||
#[Groups(['read'])]
|
||||
public function getLocation(?\DateTimeImmutable $at = null): ?Address
|
||||
{
|
||||
if ($this->getPersonLocation() instanceof Person) {
|
||||
@@ -849,10 +803,9 @@ class AccompanyingPeriod implements
|
||||
/**
|
||||
* Get where the location is.
|
||||
*
|
||||
* @Groups({"read"})
|
||||
*
|
||||
* @return 'person'|'address'|'none'
|
||||
*/
|
||||
#[Groups(['read'])]
|
||||
public function getLocationStatus(): string
|
||||
{
|
||||
if ($this->getPersonLocation() instanceof Person) {
|
||||
@@ -949,9 +902,7 @@ class AccompanyingPeriod implements
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Groups({"read"})
|
||||
*/
|
||||
#[Groups(['read'])]
|
||||
public function getPersonLocation(): ?Person
|
||||
{
|
||||
return $this->personLocation;
|
||||
@@ -971,9 +922,7 @@ class AccompanyingPeriod implements
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Groups({"read"})
|
||||
*/
|
||||
#[Groups(['read'])]
|
||||
public function getPinnedComment(): ?Comment
|
||||
{
|
||||
return $this->pinnedComment;
|
||||
@@ -1026,9 +975,7 @@ class AccompanyingPeriod implements
|
||||
return $this->remark;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Groups({"read"})
|
||||
*/
|
||||
#[Groups(['read'])]
|
||||
public function getRequestor(): Person|ThirdParty|null
|
||||
{
|
||||
return $this->requestorPerson ?? $this->requestorThirdParty;
|
||||
@@ -1254,9 +1201,7 @@ class AccompanyingPeriod implements
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Groups({"write"})
|
||||
*/
|
||||
#[Groups(['write'])]
|
||||
public function setAddressLocation(?Address $addressLocation = null): self
|
||||
{
|
||||
if ($this->addressLocation !== $addressLocation) {
|
||||
@@ -1369,9 +1314,7 @@ class AccompanyingPeriod implements
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Groups({"write"})
|
||||
*/
|
||||
#[Groups(['write'])]
|
||||
public function setPersonLocation(?Person $person = null): self
|
||||
{
|
||||
if ($this->personLocation !== $person) {
|
||||
@@ -1391,9 +1334,7 @@ class AccompanyingPeriod implements
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Groups({"write"})
|
||||
*/
|
||||
#[Groups(['write'])]
|
||||
public function setPinnedComment(?Comment $comment = null): self
|
||||
{
|
||||
if (null !== $this->pinnedComment) {
|
||||
@@ -1421,9 +1362,8 @@ class AccompanyingPeriod implements
|
||||
* @param $requestor Person|ThirdParty
|
||||
*
|
||||
* @throw UnexpectedValueException if the requestor is not a Person or ThirdParty
|
||||
*
|
||||
* @Groups({"write"})
|
||||
*/
|
||||
#[Groups(['write'])]
|
||||
public function setRequestor($requestor): self
|
||||
{
|
||||
if ($requestor instanceof Person) {
|
||||
|
Reference in New Issue
Block a user