Feature: show comment in #docgen generation for accompanying periods

This commit is contained in:
Julien Fastré 2022-07-11 19:56:59 +02:00
parent b3da9611ce
commit 5f6c11bde9
3 changed files with 10 additions and 4 deletions

View File

@ -40,7 +40,7 @@ class Comment implements TrackCreationInterface, TrackUpdateInterface
/** /**
* @ORM\Column(type="text") * @ORM\Column(type="text")
* @Groups({"read", "write"}) * @Groups({"read", "write", "docgen:read"})
* @Assert\NotBlank * @Assert\NotBlank
* @Assert\NotNull * @Assert\NotNull
*/ */
@ -48,14 +48,14 @@ class Comment implements TrackCreationInterface, TrackUpdateInterface
/** /**
* @ORM\Column(type="datetime") * @ORM\Column(type="datetime")
* @Groups({"read"}) * @Groups({"read", "docgen:read"})
*/ */
private $createdAt; private $createdAt;
/** /**
* @ORM\ManyToOne(targetEntity=User::class) * @ORM\ManyToOne(targetEntity=User::class)
* @ORM\JoinColumn(nullable=false) * @ORM\JoinColumn(nullable=false)
* @Groups({"read"}) * @Groups({"read", "docgen:read"})
*/ */
private $creator; private $creator;
@ -63,7 +63,7 @@ class Comment implements TrackCreationInterface, TrackUpdateInterface
* @ORM\Id * @ORM\Id
* @ORM\GeneratedValue * @ORM\GeneratedValue
* @ORM\Column(type="integer") * @ORM\Column(type="integer")
* @Groups({"read"}) * @Groups({"read", "docgen:read"})
*/ */
private $id; private $id;

View File

@ -71,6 +71,7 @@ class AccompanyingPeriodDocGenNormalizer implements ContextAwareNormalizerInterf
'location' => Address::class, 'location' => Address::class,
'locationPerson' => Person::class, 'locationPerson' => Person::class,
'administrativeLocation' => Location::class, 'administrativeLocation' => Location::class,
'pinnedComment' => AccompanyingPeriod\Comment::class,
]; ];
private ClosingMotiveRender $closingMotiveRender; private ClosingMotiveRender $closingMotiveRender;
@ -164,6 +165,8 @@ class AccompanyingPeriodDocGenNormalizer implements ContextAwareNormalizerInterf
'location' => $this->normalizer->normalize($period->getLocation(), $format, $addressContext), 'location' => $this->normalizer->normalize($period->getLocation(), $format, $addressContext),
'administrativeLocation' => $this->normalizer->normalize($period->getAdministrativeLocation(), $format, $administrativeLocationContext), 'administrativeLocation' => $this->normalizer->normalize($period->getAdministrativeLocation(), $format, $administrativeLocationContext),
'works' => $this->normalizer->normalize($period->getWorks(), $format, $workContext), 'works' => $this->normalizer->normalize($period->getWorks(), $format, $workContext),
'comments' => $this->normalizer->normalize($period->getComments(), $format, array_merge($context, ['docgen:expects' => AccompanyingPeriod\Comment::class])),
'pinnedComment' => $this->normalizer->normalize($period->getPinnedComment(), $format, array_merge($context, ['docgen:expects' => AccompanyingPeriod\Comment::class])),
]; ];
} }
@ -183,6 +186,7 @@ class AccompanyingPeriodDocGenNormalizer implements ContextAwareNormalizerInterf
'hasLocationPerson' => false, 'hasLocationPerson' => false,
'hasAdministrativeLocation' => false, 'hasAdministrativeLocation' => false,
'works' => [], 'works' => [],
'comments' => [],
] ]
); );
} }

View File

@ -68,6 +68,8 @@ final class AccompanyingPeriodDocGenNormalizerTest extends KernelTestCase
'closingMotive' => '@ignored', 'closingMotive' => '@ignored',
'confidential' => true, 'confidential' => true,
'confidentialText' => 'confidentiel', 'confidentialText' => 'confidentiel',
'comments' => '@ignored',
'pinnedComment' => '@ignored',
'createdAt' => '@ignored', 'createdAt' => '@ignored',
'createdBy' => '@ignored', 'createdBy' => '@ignored',
'emergency' => true, 'emergency' => true,