mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
add initial comment to accompanying period
This commit is contained in:
@@ -122,10 +122,17 @@ class AccompanyingPeriod
|
||||
* cascade={"persist", "remove"},
|
||||
* orphanRemoval=true
|
||||
* )
|
||||
* @Groups({"read"})
|
||||
*/
|
||||
private $comments;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(
|
||||
* targetEntity=Comment::class
|
||||
* )
|
||||
* @Groups({"read"})
|
||||
*/
|
||||
private ?Comment $initialComment = null;
|
||||
|
||||
/**
|
||||
* @var Collection
|
||||
*
|
||||
@@ -210,21 +217,21 @@ class AccompanyingPeriod
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
* @ORM\Column(type="boolean")
|
||||
* @ORM\Column(type="boolean", options={"default": false} )
|
||||
* @Groups({"read", "write"})
|
||||
*/
|
||||
private $requestorAnonymous = false;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
* @ORM\Column(type="boolean")
|
||||
* @ORM\Column(type="boolean", options={"default": false} )
|
||||
* @Groups({"read", "write"})
|
||||
*/
|
||||
private $emergency = false;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
* @ORM\Column(type="boolean")
|
||||
* @ORM\Column(type="boolean", options={"default": false} )
|
||||
* @Groups({"read", "write"})
|
||||
*/
|
||||
private $confidential = false;
|
||||
@@ -264,6 +271,7 @@ class AccompanyingPeriod
|
||||
$this->participations = new ArrayCollection();
|
||||
$this->scopes = new ArrayCollection();
|
||||
$this->socialIssues = new ArrayCollection();
|
||||
$this->comments = new ArrayCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -357,9 +365,14 @@ class AccompanyingPeriod
|
||||
return $this->remark;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Groups({"read"})
|
||||
*/
|
||||
public function getComments(): Collection
|
||||
{
|
||||
return $this->comments;
|
||||
return $this->comments->filter(function (Comment $c) {
|
||||
return $c !== $this->initialComment;
|
||||
});
|
||||
}
|
||||
|
||||
public function addComment(Comment $comment): self
|
||||
@@ -376,6 +389,30 @@ class AccompanyingPeriod
|
||||
$this->comments->removeElement($comment);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Groups({"write"})
|
||||
*/
|
||||
public function setInitialComment(?Comment $comment = null): self
|
||||
{
|
||||
if (NULL === $comment && NULL !== $this->initialComment) {
|
||||
$this->removeComment($this->initialComment);
|
||||
} elseif ($comment instanceof Comment) {
|
||||
$this->addComment($comment);
|
||||
}
|
||||
|
||||
$this->initialComment = $comment;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Groups({"read"})
|
||||
*/
|
||||
public function getInitialComment(): ?Comment
|
||||
{
|
||||
return $this->initialComment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Participations Collection
|
||||
*/
|
||||
|
Reference in New Issue
Block a user