From 719256913c4a9dd21a1574526962280edcb11dd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 19 Oct 2022 16:07:12 +0200 Subject: [PATCH] Feature: [docgen] Add a new variable createdAtDate, which contains date without date and time This is useful when generating a letter, to fill the today's date in the letter's header. --- .../Service/Context/BaseContextData.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Bundle/ChillDocGeneratorBundle/Service/Context/BaseContextData.php b/src/Bundle/ChillDocGeneratorBundle/Service/Context/BaseContextData.php index cbeeaeb16..e7b56ed88 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Service/Context/BaseContextData.php +++ b/src/Bundle/ChillDocGeneratorBundle/Service/Context/BaseContextData.php @@ -42,6 +42,9 @@ class BaseContextData $data['createdAt'] = $this->normalizer->normalize(new DateTimeImmutable(), 'docgen', [ 'docgen:expects' => DateTimeImmutable::class, 'groups' => ['docgen:read'], ]); + $data['createdAtDate'] = $this->normalizer->normalize(new DateTimeImmutable('today'), 'docgen', [ + 'docgen:expects' => DateTimeImmutable::class, 'groups' => ['docgen:read'], + ]); $data['location'] = $this->normalizer->normalize( $user instanceof User ? $user->getCurrentLocation() : null, 'docgen',