mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
Associate generate document with evaluation and update UX to go back to
documents
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
|
||||
use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate;
|
||||
use Chill\DocStoreBundle\Entity\StoredObject;
|
||||
use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;
|
||||
use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface;
|
||||
@@ -37,7 +38,7 @@ class AccompanyingPeriodWorkEvaluationDocument implements \Chill\MainBundle\Doct
|
||||
* inversedBy="documents"
|
||||
* )
|
||||
*/
|
||||
private ?AccompanyingPeriodWorkEvaluation $accompanyingPeriodWorkEvaluation;
|
||||
private ?AccompanyingPeriodWorkEvaluation $accompanyingPeriodWorkEvaluation = null;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(
|
||||
@@ -45,13 +46,13 @@ class AccompanyingPeriodWorkEvaluationDocument implements \Chill\MainBundle\Doct
|
||||
* )
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
private ?User $createdBy;
|
||||
private ?User $createdBy = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
private ?\DateTimeImmutable $createdAt;
|
||||
private ?\DateTimeImmutable $createdAt = null;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(
|
||||
@@ -59,18 +60,29 @@ class AccompanyingPeriodWorkEvaluationDocument implements \Chill\MainBundle\Doct
|
||||
* )
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
private ?User $updatedBy;
|
||||
private ?User $updatedBy = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
private ?DateTimeImmutable $updatedAt;
|
||||
private ?\DateTimeImmutable $updatedAt = null;
|
||||
|
||||
// TODO: indiquer le document généré par le module "document"
|
||||
private ?StoredObject $storedObject;
|
||||
/**
|
||||
* @ORM\ManyToOne(
|
||||
* targetEntity=StoredObject::class
|
||||
* )
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
private ?StoredObject $storedObject = null;
|
||||
|
||||
// TODO: ajouter gabarit
|
||||
/**
|
||||
* @ORM\ManyToOne(
|
||||
* targetEntity=DocGeneratorTemplate::class
|
||||
* )
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
private ?DocGeneratorTemplate $template = null;
|
||||
|
||||
/**
|
||||
* @return AccompanyingPeriodWorkEvaluation|null
|
||||
@@ -86,6 +98,14 @@ class AccompanyingPeriodWorkEvaluationDocument implements \Chill\MainBundle\Doct
|
||||
*/
|
||||
public function setAccompanyingPeriodWorkEvaluation(?AccompanyingPeriodWorkEvaluation $accompanyingPeriodWorkEvaluation): AccompanyingPeriodWorkEvaluationDocument
|
||||
{
|
||||
// if an evaluation is already associated, we cannot change the association (removing the association,
|
||||
// by setting a null value, is allowed.
|
||||
if ($this->accompanyingPeriodWorkEvaluation instanceof AccompanyingPeriodWorkEvaluation
|
||||
&& $accompanyingPeriodWorkEvaluation instanceof AccompanyingPeriodWorkEvaluation) {
|
||||
if ($this->accompanyingPeriodWorkEvaluation !== $accompanyingPeriodWorkEvaluation) {
|
||||
throw new \RuntimeException("It is not allowed to change the evaluation for a document");
|
||||
}
|
||||
}
|
||||
$this->accompanyingPeriodWorkEvaluation = $accompanyingPeriodWorkEvaluation;
|
||||
return $this;
|
||||
}
|
||||
@@ -172,4 +192,22 @@ class AccompanyingPeriodWorkEvaluationDocument implements \Chill\MainBundle\Doct
|
||||
return $this->updatedAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return DocGeneratorTemplate|null
|
||||
*/
|
||||
public function getTemplate(): ?DocGeneratorTemplate
|
||||
{
|
||||
return $this->template;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param DocGeneratorTemplate|null $template
|
||||
* @return AccompanyingPeriodWorkEvaluationDocument
|
||||
*/
|
||||
public function setTemplate(?DocGeneratorTemplate $template): AccompanyingPeriodWorkEvaluationDocument
|
||||
{
|
||||
$this->template = $template;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user