mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-29 19:13:49 +00:00
endpoint for recent accompanying period attributions
This commit is contained in:
@@ -338,7 +338,8 @@ class AccompanyingPeriod implements
|
||||
private ?User $user = null;
|
||||
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity=UserHistory::class, mappedBy="accompanyingPeriod")
|
||||
* @ORM\OneToMany(targetEntity=UserHistory::class, mappedBy="accompanyingPeriod", orphanRemoval=true,
|
||||
* cascade={"persist", "remove"})
|
||||
*
|
||||
* @var Collection|UserHistory[]
|
||||
*/
|
||||
@@ -1226,15 +1227,15 @@ class AccompanyingPeriod implements
|
||||
if ($this->user !== $user) {
|
||||
$this->userPrevious = $this->user;
|
||||
|
||||
if (null !== $user) {
|
||||
$this->userHistories->add(new UserHistory($this, $user));
|
||||
}
|
||||
|
||||
foreach ($this->userHistories as $history) {
|
||||
if (null === $history->getEndDate()) {
|
||||
$history->setEndDate(new DateTimeImmutable('now'));
|
||||
}
|
||||
}
|
||||
|
||||
if (null !== $user) {
|
||||
$this->userHistories->add(new UserHistory($this, $user));
|
||||
}
|
||||
}
|
||||
|
||||
$this->user = $user;
|
||||
|
Reference in New Issue
Block a user