cs: Fix code style (safe rules only).

This commit is contained in:
Pol Dellaiera
2021-11-23 14:06:38 +01:00
parent 149d7ce991
commit 8f96a1121d
1223 changed files with 65199 additions and 64625 deletions

View File

@@ -1,36 +1,37 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;
use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface;
use Chill\MainBundle\Entity\User;
use Chill\PersonBundle\Entity\SocialWork\Evaluation;
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkEvaluationDocument;
use DateInterval;
use DateTimeImmutable;
use DateTimeInterface;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use LogicException;
use RuntimeException;
use Symfony\Component\Serializer\Annotation as Serializer;
/**
* @ORM\Entity
* @ORM\Table("chill_person_accompanying_period_work_evaluation")
* @Serializer\DiscriminatorMap(typeProperty="type", mapping={
* "accompanying_period_work_evaluation"=AccompanyingPeriodWorkEvaluation::class,
* })
* "accompanying_period_work_evaluation": AccompanyingPeriodWorkEvaluation::class,
* })
*/
class AccompanyingPeriodWorkEvaluation implements TrackUpdateInterface, TrackCreationInterface
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
* @Serializer\Groups({"read"})
*/
private ?int $id = null;
/**
* @ORM\ManyToOne(
* targetEntity=AccompanyingPeriodWork::class,
@@ -40,47 +41,6 @@ class AccompanyingPeriodWorkEvaluation implements TrackUpdateInterface, TrackCre
private ?AccompanyingPeriodWork $accompanyingPeriodWork = null;
/**
* @ORM\ManyToOne(
* targetEntity=Evaluation::class
* )
* @Serializer\Groups({"read"})
* @Serializer\Groups({"accompanying_period_work_evaluation:create"})
*/
private ?Evaluation $evaluation = null;
/**
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
* @Serializer\Groups({"read"})
* @Serializer\Groups({"write"})
* @Serializer\Groups({"accompanying_period_work_evaluation:create"})
*/
private ?DateTimeImmutable $startDate = null;
/**
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
* @Serializer\Groups({"read"})
* @Serializer\Groups({"write"})
* @Serializer\Groups({"accompanying_period_work_evaluation:create"})
*/
private ?DateTimeImmutable $endDate = null;
/**
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
* @Serializer\Groups({"read"})
* @Serializer\Groups({"accompanying_period_work_evaluation:create"})
*/
private ?DateTimeImmutable $maxDate = null;
/**
* @ORM\Column(type="dateinterval", nullable=true, options={"default": null})
* @Serializer\Groups({"read"})
* @Serializer\Groups({"write"})
* @Serializer\Groups({"accompanying_period_work_evaluation:create"})
*/
private ?DateInterval $warningInterval = null;
/**
* @var string
* @ORM\Column(type="text", nullable=false, options={"default": ""})
* @Serializer\Groups({"read"})
* @Serializer\Groups({"write"})
@@ -88,14 +48,6 @@ class AccompanyingPeriodWorkEvaluation implements TrackUpdateInterface, TrackCre
*/
private string $comment = '';
/**
* @ORM\ManyToOne(
* targetEntity=User::class
* )
* @Serializer\Groups({"read"})
*/
private ?User $createdBy = null;
/**
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
* @Serializer\Groups({"read"})
@@ -108,25 +60,43 @@ class AccompanyingPeriodWorkEvaluation implements TrackUpdateInterface, TrackCre
* )
* @Serializer\Groups({"read"})
*/
private ?User $updatedBy = null;
private ?User $createdBy = null;
/**
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
* @Serializer\Groups({"read"})
*/
private ?DateTimeImmutable $updatedAt = null;
/**
* @var Collection
* @ORM\OneToMany(
* targetEntity=AccompanyingPeriodWorkEvaluationDocument::class,
* mappedBy="accompanyingPeriodWorkEvaluation",
* cascade={"remove"}
* )
* )
* @Serializer\Groups({"read"})
*/
private Collection $documents;
/**
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
* @Serializer\Groups({"read"})
* @Serializer\Groups({"write"})
* @Serializer\Groups({"accompanying_period_work_evaluation:create"})
*/
private ?DateTimeImmutable $endDate = null;
/**
* @ORM\ManyToOne(
* targetEntity=Evaluation::class
* )
* @Serializer\Groups({"read"})
* @Serializer\Groups({"accompanying_period_work_evaluation:create"})
*/
private ?Evaluation $evaluation = null;
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
* @Serializer\Groups({"read"})
*/
private ?int $id = null;
/**
* This is a workaround for client, to allow them to assign arbitrary data
* dedicated to their job.
@@ -139,251 +109,51 @@ class AccompanyingPeriodWorkEvaluation implements TrackUpdateInterface, TrackCre
* @Serializer\Groups({"accompanying_period_work_evaluation:create"})
*
* @var mixed
*
*/
private $key = null;
private $key;
/**
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
* @Serializer\Groups({"read"})
* @Serializer\Groups({"accompanying_period_work_evaluation:create"})
*/
private ?DateTimeImmutable $maxDate = null;
/**
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
* @Serializer\Groups({"read"})
* @Serializer\Groups({"write"})
* @Serializer\Groups({"accompanying_period_work_evaluation:create"})
*/
private ?DateTimeImmutable $startDate = null;
/**
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
* @Serializer\Groups({"read"})
*/
private ?DateTimeImmutable $updatedAt = null;
/**
* @ORM\ManyToOne(
* targetEntity=User::class
* )
* @Serializer\Groups({"read"})
*/
private ?User $updatedBy = null;
/**
* @ORM\Column(type="dateinterval", nullable=true, options={"default": null})
* @Serializer\Groups({"read"})
* @Serializer\Groups({"write"})
* @Serializer\Groups({"accompanying_period_work_evaluation:create"})
*/
private ?DateInterval $warningInterval = null;
public function __construct()
{
$this->documents = new ArrayCollection();
}
/**
* @return int|null
*/
public function getId(): ?int
{
return $this->id;
}
/**
* @return AccompanyingPeriodWork|null
*/
public function getAccompanyingPeriodWork(): ?AccompanyingPeriodWork
{
return $this->accompanyingPeriodWork;
}
/**
* @param AccompanyingPeriodWork|null $accompanyingPeriodWork
* @return AccompanyingPeriodWorkEvaluation
*/
public function setAccompanyingPeriodWork(?AccompanyingPeriodWork $accompanyingPeriodWork): AccompanyingPeriodWorkEvaluation
{
if (
$accompanyingPeriodWork instanceof AccompanyingPeriodWork
&& $this->accompanyingPeriodWork instanceof AccompanyingPeriodWork
&& $this->accompanyingPeriodWork->getId() !== $accompanyingPeriodWork->getId()) {
throw new \RuntimeException("Changing the ".
"accompanyingPeriodWork is not allowed");
}
$this->accompanyingPeriodWork = $accompanyingPeriodWork;
return $this;
}
/**
* @return Evaluation|null
*/
public function getEvaluation(): ?Evaluation
{
return $this->evaluation;
}
/**
* @param Evaluation|null $evaluation
* @return AccompanyingPeriodWorkEvaluation
*/
public function setEvaluation(?Evaluation $evaluation): AccompanyingPeriodWorkEvaluation
{
if (
($evaluation instanceof Evaluation
&& $this->evaluation instanceof Evaluation
&& $evaluation->getId() !== $this->evaluation->getId())
||
($this->evaluation instanceof Evaluation
&& null === $evaluation)
) {
$cl = AccompanyingPeriodWorkEvaluation::class;
throw new \LogicException("once set, an $cl cannot
change or remove the linked Evaluation::class");
}
$this->evaluation = $evaluation;
return $this;
}
/**
* @return DateTimeImmutable|null
*/
public function getStartDate(): ?DateTimeImmutable
{
return $this->startDate;
}
/**
* @param DateTimeImmutable|null $startDate
* @return AccompanyingPeriodWorkEvaluation
*/
public function setStartDate(?DateTimeImmutable $startDate): AccompanyingPeriodWorkEvaluation
{
$this->startDate = $startDate;
return $this;
}
/**
* @return DateTimeImmutable|null
*/
public function getEndDate(): ?DateTimeImmutable
{
return $this->endDate;
}
/**
* @param DateTimeImmutable|null $endDate
* @return AccompanyingPeriodWorkEvaluation
*/
public function setEndDate(?DateTimeImmutable $endDate): AccompanyingPeriodWorkEvaluation
{
$this->endDate = $endDate;
return $this;
}
/**
* @return DateTimeImmutable|null
*/
public function getMaxDate(): ?DateTimeImmutable
{
return $this->maxDate;
}
/**
* @param DateTimeImmutable|null $maxDate
* @return AccompanyingPeriodWorkEvaluation
*/
public function setMaxDate(?DateTimeImmutable $maxDate): AccompanyingPeriodWorkEvaluation
{
$this->maxDate = $maxDate;
return $this;
}
/**
* @return DateInterval|null
*/
public function getWarningInterval(): ?DateInterval
{
return $this->warningInterval;
}
/**
* @param DateInterval|null $warningInterval
* @return AccompanyingPeriodWorkEvaluation
*/
public function setWarningInterval(?DateInterval $warningInterval): AccompanyingPeriodWorkEvaluation
{
$this->warningInterval = $warningInterval;
return $this;
}
/**
* @return string
*/
public function getComment(): string
{
return $this->comment;
}
/**
* @param string $comment
* @return AccompanyingPeriodWorkEvaluation
*/
public function setComment(string $comment): AccompanyingPeriodWorkEvaluation
{
$this->comment = $comment;
return $this;
}
/**
* @return User|null
*/
public function getCreatedBy(): ?User
{
return $this->createdBy;
}
/**
* @param User|null $createdBy
* @return AccompanyingPeriodWorkEvaluation
*/
public function setCreatedBy(?User $createdBy): AccompanyingPeriodWorkEvaluation
{
$this->createdBy = $createdBy;
return $this;
}
/**
* @return DateTimeImmutable|null
*/
public function getCreatedAt(): ?DateTimeImmutable
{
return $this->createdAt;
}
/**
* @param DateTimeImmutable|null $createdAt
* @return AccompanyingPeriodWorkEvaluation
*/
public function setCreatedAt(\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
/**
* @return User|null
*/
public function getUpdatedBy(): ?User
{
return $this->updatedBy;
}
/**
* @param User|null $updatedBy
* @return AccompanyingPeriodWorkEvaluation
*/
public function setUpdatedBy(?User $updatedBy): AccompanyingPeriodWorkEvaluation
{
$this->updatedBy = $updatedBy;
return $this;
}
/**
* @return DateTimeImmutable|null
*/
public function getUpdatedAt(): ?DateTimeImmutable
{
return $this->updatedAt;
}
/**
* @param DateTimeImmutable|null $updatedAt
* @return AccompanyingPeriodWorkEvaluation
*/
public function setUpdatedAt(\DateTimeInterface $updatedAt): self
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* @return Collection
*/
public function getDocuments()
{
return $this->documents;
}
public function addDocument(AccompanyingPeriodWorkEvaluationDocument $document): self
{
if (!$this->documents->contains($document)) {
@@ -394,14 +164,51 @@ class AccompanyingPeriodWorkEvaluation implements TrackUpdateInterface, TrackCre
return $this;
}
public function removeDocument(AccompanyingPeriodWorkEvaluationDocument $document): self
public function getAccompanyingPeriodWork(): ?AccompanyingPeriodWork
{
$this->documents->removeElement($document);
return $this;
return $this->accompanyingPeriodWork;
}
public function getComment(): string
{
return $this->comment;
}
public function getCreatedAt(): ?DateTimeImmutable
{
return $this->createdAt;
}
public function getCreatedBy(): ?User
{
return $this->createdBy;
}
/**
* Arbitrary data, used for client
* @return Collection
*/
public function getDocuments()
{
return $this->documents;
}
public function getEndDate(): ?DateTimeImmutable
{
return $this->endDate;
}
public function getEvaluation(): ?Evaluation
{
return $this->evaluation;
}
public function getId(): ?int
{
return $this->id;
}
/**
* Arbitrary data, used for client.
*
* @return mixed
*/
@@ -410,10 +217,111 @@ class AccompanyingPeriodWorkEvaluation implements TrackUpdateInterface, TrackCre
return $this->key;
}
public function getMaxDate(): ?DateTimeImmutable
{
return $this->maxDate;
}
public function getStartDate(): ?DateTimeImmutable
{
return $this->startDate;
}
public function getUpdatedAt(): ?DateTimeImmutable
{
return $this->updatedAt;
}
public function getUpdatedBy(): ?User
{
return $this->updatedBy;
}
public function getWarningInterval(): ?DateInterval
{
return $this->warningInterval;
}
public function removeDocument(AccompanyingPeriodWorkEvaluationDocument $document): self
{
$this->documents->removeElement($document);
return $this;
}
public function setAccompanyingPeriodWork(?AccompanyingPeriodWork $accompanyingPeriodWork): AccompanyingPeriodWorkEvaluation
{
if (
$accompanyingPeriodWork instanceof AccompanyingPeriodWork
&& $this->accompanyingPeriodWork instanceof AccompanyingPeriodWork
&& $this->accompanyingPeriodWork->getId() !== $accompanyingPeriodWork->getId()) {
throw new RuntimeException('Changing the ' .
'accompanyingPeriodWork is not allowed');
}
$this->accompanyingPeriodWork = $accompanyingPeriodWork;
return $this;
}
public function setComment(string $comment): AccompanyingPeriodWorkEvaluation
{
$this->comment = $comment;
return $this;
}
/**
* Arbitrary data, used for client
* @param DateTimeImmutable|null $createdAt
*
* @return AccompanyingPeriodWorkEvaluation
*/
public function setCreatedAt(DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function setCreatedBy(?User $createdBy): AccompanyingPeriodWorkEvaluation
{
$this->createdBy = $createdBy;
return $this;
}
public function setEndDate(?DateTimeImmutable $endDate): AccompanyingPeriodWorkEvaluation
{
$this->endDate = $endDate;
return $this;
}
public function setEvaluation(?Evaluation $evaluation): AccompanyingPeriodWorkEvaluation
{
if (
($evaluation instanceof Evaluation
&& $this->evaluation instanceof Evaluation
&& $evaluation->getId() !== $this->evaluation->getId())
|| ($this->evaluation instanceof Evaluation
&& null === $evaluation)
) {
$cl = AccompanyingPeriodWorkEvaluation::class;
throw new LogicException("once set, an {$cl} cannot
change or remove the linked Evaluation::class");
}
$this->evaluation = $evaluation;
return $this;
}
/**
* Arbitrary data, used for client.
*
* @param mixed $key
*
* @return AccompanyingPeriodWorkEvaluation
*/
public function setKey($key): self
@@ -422,4 +330,44 @@ class AccompanyingPeriodWorkEvaluation implements TrackUpdateInterface, TrackCre
return $this;
}
public function setMaxDate(?DateTimeImmutable $maxDate): AccompanyingPeriodWorkEvaluation
{
$this->maxDate = $maxDate;
return $this;
}
public function setStartDate(?DateTimeImmutable $startDate): AccompanyingPeriodWorkEvaluation
{
$this->startDate = $startDate;
return $this;
}
/**
* @param DateTimeImmutable|null $updatedAt
*
* @return AccompanyingPeriodWorkEvaluation
*/
public function setUpdatedAt(DateTimeInterface $updatedAt): self
{
$this->updatedAt = $updatedAt;
return $this;
}
public function setUpdatedBy(?User $updatedBy): AccompanyingPeriodWorkEvaluation
{
$this->updatedBy = $updatedBy;
return $this;
}
public function setWarningInterval(?DateInterval $warningInterval): AccompanyingPeriodWorkEvaluation
{
$this->warningInterval = $warningInterval;
return $this;
}
}