Update AccompanyingPeriod normalization with UserHistory

The AccompanyingPeriod normalization now includes 'createdBy' and 'ref' fields from the UserHistory. AccompanyingPeriodDocGenNormalizer has been modified adding UserHistory retrieval and subsequently normalization. A new method was also added to the AccompanyingPeriod entity to retrieve the current UserHistory.
This commit is contained in:
2024-06-11 16:33:37 +02:00
parent 0ce9cdd07a
commit 350d991a85
2 changed files with 16 additions and 2 deletions

View File

@@ -1507,6 +1507,16 @@ class AccompanyingPeriod implements
return $this;
}
public function getUserHistories(): ReadableCollection
{
return $this->userHistories;
}
public function getCurrentUserHistory(): ?UserHistory
{
return $this->getUserHistories()->findFirst(fn (int $key, UserHistory $userHistory) => $userHistory->getEndDate() === null);
}
private function addStepHistory(AccompanyingPeriodStepHistory $stepHistory, array $context = []): self
{
if (!$this->stepHistories->contains($stepHistory)) {