mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
apply more cs rules for php-cs
This commit is contained in:
@@ -22,19 +22,18 @@ use Chill\PersonBundle\Entity\SocialWork\Result;
|
||||
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
|
||||
use Chill\PersonBundle\Entity\SocialWork\SocialIssue;
|
||||
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
||||
use DateTimeImmutable;
|
||||
use DateTimeInterface;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\Common\Collections\ReadableCollection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use LogicException;
|
||||
use Symfony\Component\Serializer\Annotation as Serializer;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
/**
|
||||
* @ORM\Entity
|
||||
*
|
||||
* @ORM\Table(name="chill_person_accompanying_period_work")
|
||||
*
|
||||
* @Serializer\DiscriminatorMap(
|
||||
* typeProperty="type",
|
||||
* mapping={
|
||||
@@ -46,7 +45,9 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
|
||||
{
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=AccompanyingPeriod::class)
|
||||
*
|
||||
* @Serializer\Groups({"read", "read:accompanyingPeriodWork:light"})
|
||||
*
|
||||
* @Serializer\Context(normalizationContext={"groups": {"read"}}, groups={"read:accompanyingPeriodWork:light"})
|
||||
*/
|
||||
private ?AccompanyingPeriod $accompanyingPeriod = null;
|
||||
@@ -58,8 +59,11 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
|
||||
* cascade={"remove", "persist"},
|
||||
* orphanRemoval=true
|
||||
* )
|
||||
*
|
||||
* @Serializer\Groups({"read", "docgen:read"})
|
||||
*
|
||||
* @ORM\OrderBy({"startDate": "DESC", "id": "DESC"})
|
||||
*
|
||||
* @var Collection<AccompanyingPeriodWorkEvaluation>
|
||||
*
|
||||
* @internal /!\ the serialization for write evaluations is handled in `AccompanyingPeriodWorkDenormalizer`
|
||||
@@ -68,48 +72,57 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="datetime_immutable")
|
||||
*
|
||||
* @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"})
|
||||
*/
|
||||
private ?DateTimeImmutable $createdAt = null;
|
||||
private ?\DateTimeImmutable $createdAt = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="boolean")
|
||||
*
|
||||
* @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"})
|
||||
*/
|
||||
private bool $createdAutomatically = false;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text")
|
||||
*
|
||||
* @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"})
|
||||
*/
|
||||
private string $createdAutomaticallyReason = '';
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=User::class)
|
||||
*
|
||||
* @ORM\JoinColumn(nullable=false)
|
||||
*
|
||||
* @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"})
|
||||
*/
|
||||
private ?User $createdBy = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
|
||||
*
|
||||
* @Serializer\Groups({"accompanying_period_work:create"})
|
||||
* @Serializer\Groups({"accompanying_period_work:edit"})
|
||||
* @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"})
|
||||
*
|
||||
* @Assert\GreaterThanOrEqual(propertyPath="startDate",
|
||||
* message="accompanying_course_work.The endDate should be greater or equal than the start date"
|
||||
* )
|
||||
*/
|
||||
private ?DateTimeImmutable $endDate = null;
|
||||
private ?\DateTimeImmutable $endDate = null;
|
||||
|
||||
/**
|
||||
* @var Collection<AccompanyingPeriodWorkGoal>
|
||||
*
|
||||
* @ORM\OneToMany(
|
||||
* targetEntity=AccompanyingPeriodWorkGoal::class,
|
||||
* mappedBy="accompanyingPeriodWork",
|
||||
* cascade={"persist"},
|
||||
* orphanRemoval=true
|
||||
* )
|
||||
*
|
||||
* @Serializer\Groups({"read", "docgen:read"})
|
||||
* @Serializer\Groups({"accompanying_period_work:edit"})
|
||||
*/
|
||||
@@ -117,6 +130,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=ThirdParty::class)
|
||||
*
|
||||
* @Serializer\Groups({"read", "docgen:read"})
|
||||
* @Serializer\Groups({"accompanying_period_work:edit"})
|
||||
*
|
||||
@@ -126,22 +140,29 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
|
||||
|
||||
/**
|
||||
* @ORM\Id
|
||||
*
|
||||
* @ORM\GeneratedValue
|
||||
*
|
||||
* @ORM\Column(type="integer")
|
||||
*
|
||||
* @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light", "read:evaluation:include-work"})
|
||||
*/
|
||||
private ?int $id = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text")
|
||||
*
|
||||
* @Serializer\Groups({"read", "accompanying_period_work:edit", "docgen:read"})
|
||||
*/
|
||||
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"})
|
||||
* @Serializer\Groups({"accompanying_period_work:edit"})
|
||||
* @Serializer\Groups({"accompanying_period_work:create"})
|
||||
@@ -150,20 +171,25 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
|
||||
|
||||
/**
|
||||
* @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable", columnPrefix="privateComment_")
|
||||
*
|
||||
* @Serializer\Groups({"read", "accompanying_period_work:edit"})
|
||||
*/
|
||||
private PrivateCommentEmbeddable $privateComment;
|
||||
|
||||
/**
|
||||
* @var Collection<int, AccompanyingPeriodWorkReferrerHistory>
|
||||
*
|
||||
* @ORM\OneToMany(targetEntity=AccompanyingPeriodWorkReferrerHistory::class, cascade={"persist", "remove"}, mappedBy="accompanyingPeriodWork", orphanRemoval=true)
|
||||
*/
|
||||
private Collection $referrersHistory;
|
||||
|
||||
/**
|
||||
* @var Collection<Result>
|
||||
*
|
||||
* @ORM\ManyToMany(targetEntity=Result::class, inversedBy="accompanyingPeriodWorks")
|
||||
*
|
||||
* @ORM\JoinTable(name="chill_person_accompanying_period_work_result")
|
||||
*
|
||||
* @Serializer\Groups({"read", "docgen:read"})
|
||||
* @Serializer\Groups({"accompanying_period_work:edit"})
|
||||
*/
|
||||
@@ -171,26 +197,32 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=SocialAction::class)
|
||||
*
|
||||
* @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"})
|
||||
* @Serializer\Groups({"accompanying_period_work:create"})
|
||||
*
|
||||
* @Serializer\Context(normalizationContext={"groups": {"read"}}, groups={"read:accompanyingPeriodWork:light"})
|
||||
*/
|
||||
private ?SocialAction $socialAction = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="date_immutable")
|
||||
*
|
||||
* @Serializer\Groups({"accompanying_period_work:create"})
|
||||
* @Serializer\Groups({"accompanying_period_work:edit"})
|
||||
* @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"})
|
||||
*/
|
||||
private ?DateTimeImmutable $startDate = null;
|
||||
private ?\DateTimeImmutable $startDate = null;
|
||||
|
||||
/**
|
||||
* @var Collection<ThirdParty>
|
||||
*
|
||||
* @ORM\ManyToMany(targetEntity=ThirdParty::class)
|
||||
*
|
||||
* @ORM\JoinTable(name="chill_person_accompanying_period_work_third_party")
|
||||
*
|
||||
* In schema : intervenants
|
||||
*
|
||||
* @Serializer\Groups({"read", "docgen:read"})
|
||||
* @Serializer\Groups({"accompanying_period_work:edit"})
|
||||
*/
|
||||
@@ -198,13 +230,16 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="datetime_immutable")
|
||||
*
|
||||
* @Serializer\Groups({"read", "docgen:read"})
|
||||
*/
|
||||
private ?DateTimeImmutable $updatedAt = null;
|
||||
private ?\DateTimeImmutable $updatedAt = null;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=User::class)
|
||||
*
|
||||
* @ORM\JoinColumn(nullable=false)
|
||||
*
|
||||
* @Serializer\Groups({"read", "docgen:read"})
|
||||
*/
|
||||
private ?User $updatedBy = null;
|
||||
@@ -253,7 +288,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
|
||||
{
|
||||
if (!$this->getReferrers()->contains($referrer)) {
|
||||
$this->referrersHistory[] =
|
||||
new AccompanyingPeriodWorkReferrerHistory($this, $referrer, new DateTimeImmutable('today'));
|
||||
new AccompanyingPeriodWorkReferrerHistory($this, $referrer, new \DateTimeImmutable('today'));
|
||||
}
|
||||
|
||||
return $this;
|
||||
@@ -290,7 +325,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
|
||||
return $this->accompanyingPeriodWorkEvaluations;
|
||||
}
|
||||
|
||||
public function getCreatedAt(): ?DateTimeImmutable
|
||||
public function getCreatedAt(): ?\DateTimeImmutable
|
||||
{
|
||||
return $this->createdAt;
|
||||
}
|
||||
@@ -310,7 +345,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
|
||||
return $this->createdBy;
|
||||
}
|
||||
|
||||
public function getEndDate(): ?DateTimeInterface
|
||||
public function getEndDate(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->endDate;
|
||||
}
|
||||
@@ -350,6 +385,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
|
||||
|
||||
/**
|
||||
* @return ReadableCollection<int, User>
|
||||
*
|
||||
* @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"})
|
||||
* @Serializer\Groups({"accompanying_period_work:edit"})
|
||||
* @Serializer\Groups({"accompanying_period_work:create"})
|
||||
@@ -366,7 +402,6 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
|
||||
return $this->referrersHistory;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return Collection<int, Result>
|
||||
*/
|
||||
@@ -385,7 +420,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
|
||||
return new ArrayCollection([$this->getSocialAction()->getIssue()]);
|
||||
}
|
||||
|
||||
public function getStartDate(): ?DateTimeInterface
|
||||
public function getStartDate(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->startDate;
|
||||
}
|
||||
@@ -403,7 +438,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
|
||||
return $this->getThirdParties();
|
||||
}
|
||||
|
||||
public function getUpdatedAt(): ?DateTimeImmutable
|
||||
public function getUpdatedAt(): ?\DateTimeImmutable
|
||||
{
|
||||
return $this->updatedAt;
|
||||
}
|
||||
@@ -445,7 +480,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
|
||||
{
|
||||
foreach ($this->referrersHistory as $history) {
|
||||
if ($history->isOpen() && $referrer === $history->getUser()) {
|
||||
$history->setEndDate(new DateTimeImmutable('today'));
|
||||
$history->setEndDate(new \DateTimeImmutable('today'));
|
||||
|
||||
if ($history->isDateRangeEmpty()) {
|
||||
$history->removeAccompanyingPeriodWork();
|
||||
@@ -488,7 +523,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
|
||||
$this->accompanyingPeriod instanceof AccompanyingPeriod
|
||||
&& $accompanyingPeriod !== $this->accompanyingPeriod
|
||||
) {
|
||||
throw new LogicException('A work cannot change accompanyingPeriod');
|
||||
throw new \LogicException('A work cannot change accompanyingPeriod');
|
||||
}
|
||||
|
||||
$this->accompanyingPeriod = $accompanyingPeriod;
|
||||
@@ -496,7 +531,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setCreatedAt(DateTimeInterface $createdAt): self
|
||||
public function setCreatedAt(\DateTimeInterface $createdAt): self
|
||||
{
|
||||
$this->createdAt = $createdAt;
|
||||
|
||||
@@ -524,7 +559,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setEndDate(?DateTimeInterface $endDate = null): self
|
||||
public function setEndDate(\DateTimeInterface $endDate = null): self
|
||||
{
|
||||
$this->endDate = $endDate;
|
||||
|
||||
@@ -559,14 +594,14 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setStartDate(DateTimeInterface $startDate): self
|
||||
public function setStartDate(\DateTimeInterface $startDate): self
|
||||
{
|
||||
$this->startDate = $startDate;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setUpdatedAt(DateTimeInterface $datetime): TrackUpdateInterface
|
||||
public function setUpdatedAt(\DateTimeInterface $datetime): TrackUpdateInterface
|
||||
{
|
||||
$this->updatedAt = $datetime;
|
||||
|
||||
|
Reference in New Issue
Block a user