Merge branch add-location-period into 'master'

This commit is contained in:
2021-08-17 18:37:07 +02:00
103 changed files with 6268 additions and 1082 deletions

View File

@@ -841,7 +841,9 @@ class AccompanyingPeriod implements TrackCreationInterface, TrackUpdateInterface
public function addSocialIssue(SocialIssue $socialIssue): self
{
$this->socialIssues[] = $socialIssue;
if (!$this->socialIssues->contains($socialIssue)) {
$this->socialIssues[] = $socialIssue;
}
return $this;
}

View File

@@ -160,12 +160,26 @@ use Symfony\Component\Validator\Constraints as Assert;
*/
private Collection $persons;
/**
* @var Collection
* @ORM\OneToMany(
* targetEntity=AccompanyingPeriodWorkEvaluation::class,
* mappedBy="accompanyingPeriodWork",
* cascade={"persist"},
* orphanRemoval=true
* )
* @Serializer\Groups({"read"})
* @internal /!\ the serialization for read / write evaluations is handled in `AccompanyingPeriodWorkDenormalizer`
*/
private Collection $accompanyingPeriodWorkEvaluations;
public function __construct()
{
$this->goals = new ArrayCollection();
$this->results = new ArrayCollection();
$this->thirdParties = new ArrayCollection();
$this->persons = new ArrayCollection();
$this->accompanyingPeriodWorkEvaluations = new ArrayCollection();
}
public function getId(): ?int
@@ -388,6 +402,11 @@ use Symfony\Component\Validator\Constraints as Assert;
return $this->thirdParties;
}
public function getThirdPartys(): Collection
{
return $this->getThirdParties();
}
public function addThirdParty(ThirdParty $thirdParty): self
{
if (!$this->thirdParties->contains($thirdParty)) {
@@ -424,4 +443,31 @@ use Symfony\Component\Validator\Constraints as Assert;
return $this;
}
/**
* @return Collection
*/
public function getAccompanyingPeriodWorkEvaluations()
{
return $this->accompanyingPeriodWorkEvaluations;
}
public function addAccompanyingPeriodWorkEvaluation(AccompanyingPeriodWorkEvaluation $evaluation): self
{
if (!$this->accompanyingPeriodWorkEvaluations->contains($evaluation)) {
$this->accompanyingPeriodWorkEvaluations[] = $evaluation;
$evaluation->setAccompanyingPeriodWork($this);
}
return $this;
}
public function removeAccompanyingPeriodWorkEvaluation(AccompanyingPeriodWorkEvaluation $evaluation): self
{
$this->accompanyingPeriodWorkEvaluations
->removeElement($evaluation);
$evaluation->setAccompanyingPeriodWork(null);
return $this;
}
}

View File

@@ -0,0 +1,369 @@
<?php
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 Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
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,
* })
*/
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,
* inversedBy="accompanyingPeriodWorkEvaluations"
* )
*/
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({"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"})
* @Serializer\Groups({"accompanying_period_work_evaluation:create"})
*/
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"})
*/
private ?DateTimeImmutable $createdAt = null;
/**
* @ORM\ManyToOne(
* targetEntity=User::class
* )
* @Serializer\Groups({"read"})
*/
private ?User $updatedBy = 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"
* )
* @Serializer\Groups({"read"})
*/
private Collection $documents;
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)
) {
throw new \LogicException("once set, an ${self::class} 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;
}
}

View File

@@ -0,0 +1,175 @@
<?php
namespace Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\DocStoreBundle\Entity\StoredObject;
use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;
use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface;
use Chill\MainBundle\Entity\User;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation as Serializer;
/**
* @ORM\Entity
* @ORM\Table("chill_person_accompanying_period_work_evaluation_document")
* @Serializer\DiscriminatorMap(typeProperty="type", mapping={
* "accompanying_period_work_evaluation_document"=AccompanyingPeriodWorkEvaluationDocument::class
* })
*/
class AccompanyingPeriodWorkEvaluationDocument implements \Chill\MainBundle\Doctrine\Model\TrackCreationInterface, \Chill\MainBundle\Doctrine\Model\TrackUpdateInterface
{
/**
* @var int|null
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*
* @internal the default name exceeds 64 characters, we must set manually:
* @ORM\SequenceGenerator(sequenceName="chill_person_social_work_eval_doc_id_seq", allocationSize=1, initialValue=1000)
* @Serializer\Groups({"read"})
*/
private ?int $id;
/**
* @var AccompanyingPeriodWorkEvaluation|null
* @ORM\ManyToOne(
* targetEntity=AccompanyingPeriodWorkEvaluation::class,
* inversedBy="documents"
* )
*/
private ?AccompanyingPeriodWorkEvaluation $accompanyingPeriodWorkEvaluation;
/**
* @ORM\ManyToOne(
* targetEntity=User::class
* )
* @Serializer\Groups({"read"})
*/
private ?User $createdBy;
/**
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
* @Serializer\Groups({"read"})
*/
private ?\DateTimeImmutable $createdAt;
/**
* @ORM\ManyToOne(
* targetEntity=User::class
* )
* @Serializer\Groups({"read"})
*/
private ?User $updatedBy;
/**
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
* @Serializer\Groups({"read"})
*/
private ?DateTimeImmutable $updatedAt;
// TODO: indiquer le document généré par le module "document"
private ?StoredObject $storedObject;
// TODO: ajouter gabarit
/**
* @return AccompanyingPeriodWorkEvaluation|null
*/
public function getAccompanyingPeriodWorkEvaluation(): ?AccompanyingPeriodWorkEvaluation
{
return $this->accompanyingPeriodWorkEvaluation;
}
/**
* @param AccompanyingPeriodWorkEvaluation|null $accompanyingPeriodWorkEvaluation
* @return AccompanyingPeriodWorkEvaluationDocument
*/
public function setAccompanyingPeriodWorkEvaluation(?AccompanyingPeriodWorkEvaluation $accompanyingPeriodWorkEvaluation): AccompanyingPeriodWorkEvaluationDocument
{
$this->accompanyingPeriodWorkEvaluation = $accompanyingPeriodWorkEvaluation;
return $this;
}
/**
* @return StoredObject|null
*/
public function getStoredObject(): ?StoredObject
{
return $this->storedObject;
}
/**
* @param StoredObject|null $storedObject
* @return AccompanyingPeriodWorkEvaluationDocument
*/
public function setStoredObject(?StoredObject $storedObject): AccompanyingPeriodWorkEvaluationDocument
{
$this->storedObject = $storedObject;
return $this;
}
public function setCreatedBy(User $user): \Chill\MainBundle\Doctrine\Model\TrackCreationInterface
{
$this->createdBy = $user;
return $this;
}
public function setCreatedAt(\DateTimeInterface $datetime): \Chill\MainBundle\Doctrine\Model\TrackCreationInterface
{
$this->createdAt = $datetime;
return $this;
}
public function setUpdatedBy(User $user): \Chill\MainBundle\Doctrine\Model\TrackUpdateInterface
{
$this->updatedBy = $user;
return $this;
}
public function setUpdatedAt(\DateTimeInterface $datetime): \Chill\MainBundle\Doctrine\Model\TrackUpdateInterface
{
$this->updatedAt = $datetime;
return $this;
}
/**
* @return int|null
*/
public function getId(): ?int
{
return $this->id;
}
/**
* @return User|null
*/
public function getCreatedBy(): ?User
{
return $this->createdBy;
}
/**
* @return \DateTimeImmutable|null
*/
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
/**
* @return User|null
*/
public function getUpdatedBy(): ?User
{
return $this->updatedBy;
}
/**
* @return DateTimeImmutable|null
*/
public function getUpdatedAt(): ?DateTimeInterface
{
return $this->updatedAt;
}
}

View File

@@ -3,10 +3,14 @@
namespace Chill\PersonBundle\Entity\SocialWork;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation as Serializer;
/**
* @ORM\Entity
* @ORM\Table(name="chill_person_social_work_evaluation")
* @Serializer\DiscriminatorMap(typeProperty="type", mapping={
* "social_work_evaluation"=Evaluation::class
* })
*/
class Evaluation
{
@@ -14,26 +18,33 @@ class Evaluation
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
* @Serializer\Groups({"read"})
*/
private $id;
/**
* @ORM\Column(type="json")
* @Serializer\Groups({"read"})
*/
private $title = [];
/**
* @ORM\Column(type="dateinterval", nullable=true)
* @ORM\Column(type="dateinterval", nullable=true, options={"default": null})
* @Serializer\Groups({"read"})
*/
private $delay;
/**
* @ORM\Column(type="dateinterval")
* @ORM\Column(type="dateinterval", nullable=true, options={"default": null})
* @Serializer\Groups({"read"})
*/
private $notificationDelay;
/**
* @ORM\ManyToOne(targetEntity=SocialAction::class)
* @ORM\ManyToOne(
* targetEntity=SocialAction::class,
* inversedBy="evaluations"
* )
*/
private $socialAction;

View File

@@ -68,6 +68,15 @@ class SocialAction
*/
private $results;
/**
* @var Collection
* @ORM\OneToMany(
* targetEntity=Evaluation::class,
* mappedBy="socialAction"
* )
*/
private Collection $evaluations;
public function __construct()
{
$this->children = new ArrayCollection();
@@ -257,4 +266,12 @@ class SocialAction
return $this;
}
/**
* @return Collection
*/
public function getEvaluations(): Collection
{
return $this->evaluations;
}
}