diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php index da1709f48..ab51bbf85 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php @@ -692,6 +692,10 @@ class AccompanyingPeriod implements return [[self::STEP_DRAFT, self::STEP_CONFIRMED]]; } + if ($this->getStep() === self::STEP_CLOSED) { + return [[self::STEP_DRAFT, self::STEP_CONFIRMED, self::STEP_CLOSED]]; + } + throw new LogicException('no validation group permitted with this step: ' . $this->getStep()); } diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Origin.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Origin.php index 7a1114b3e..492d7d995 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Origin.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Origin.php @@ -14,7 +14,6 @@ namespace Chill\PersonBundle\Entity\AccompanyingPeriod; use DateTimeImmutable; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation as Serializer; -use Symfony\Component\Serializer\Annotation\Groups; /** * @ORM\Entity @@ -31,20 +30,20 @@ class Origin * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") - * @Groups({"read", "docgen:read"}) + * @Serializer\Groups({"read", "docgen:read"}) */ private ?int $id = null; /** * @ORM\Column(type="json") - * @Groups({"read", "docgen:read"}) + * @Serializer\Groups({"read", "docgen:read"}) * @Serializer\Context({"is-translatable": true}, groups={"docgen:read"}) */ private array $label = []; /** * @ORM\Column(type="date_immutable", nullable=true) - * @Groups({"read"}) + * @Serializer\Groups({"read"}) */ private ?DateTimeImmutable $noActiveAfter = null; diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodDocGenNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodDocGenNormalizer.php index fab2a022d..79adc560c 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodDocGenNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodDocGenNormalizer.php @@ -121,6 +121,7 @@ class AccompanyingPeriodDocGenNormalizer implements ContextAwareNormalizerInterf 'type' => 'accompanying_period', 'isNull' => false, 'closingDate' => $this->normalizer->normalize($period->getClosingDate(), $format, $dateContext), + 'closingMotive' => $this->normalizer->normalize($period->getClosingMotive(), $format, array_merge($context, ['docgen:expects' => AccompanyingPeriod\ClosingMotive::class])), 'confidential' => $period->isConfidential(), 'createdAt' => $this->normalizer->normalize($period->getCreatedAt(), $format, $dateContext), 'createdBy' => $this->normalizer->normalize($period->getCreatedBy(), $format, $userContext), diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodOriginNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodOriginNormalizer.php index 66f65b67b..6cc3d446b 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodOriginNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodOriginNormalizer.php @@ -35,6 +35,6 @@ final class AccompanyingPeriodOriginNormalizer implements NormalizerInterface public function supportsNormalization($data, $format = null): bool { - return $data instanceof Origin; + return $data instanceof Origin && $format === 'json'; } }