Add new normalization methods on filters, aggregators exports and formatter by applying rector rule

This commit is contained in:
2025-03-11 22:28:42 +01:00
parent 6cb23344fc
commit 0d2a487ae7
247 changed files with 3794 additions and 42 deletions

View File

@@ -20,6 +20,7 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
class BirthdateFilter implements ExportElementValidatedInterface, FilterInterface
{
use \Chill\MainBundle\Export\ExportDataNormalizerTrait;
// add specific role for this filter
public function addRole(): ?string
{
@@ -74,6 +75,18 @@ class BirthdateFilter implements ExportElementValidatedInterface, FilterInterfac
'format' => 'dd-MM-yyyy',
]);
}
public function getNormalizationVersion(): int
{
return 1;
}
public function normalizeFormData(array $formData): array
{
return ['date_from' => $this->normalizeDate($formData['date_from']), 'date_to' => $this->normalizeDate($formData['date_to'])];
}
public function denormalizeFormData(array $formData, int $fromVersion): array
{
return ['date_from' => $this->denormalizeDate($formData['date_from']), 'date_to' => $this->denormalizeDate($formData['date_to'])];
}
public function getFormDefaultData(): array
{
return ['date_from' => new DateTime(), 'date_to' => new DateTime()];

View File

@@ -36,6 +36,18 @@ class CountPerson implements ExportInterface
{
// this export does not add any form
}
public function getNormalizationVersion(): int
{
return 1;
}
public function normalizeFormData(array $formData): array
{
return [];
}
public function denormalizeFormData(array $formData, int $fromVersion): array
{
return [];
}
public function getFormDefaultData(): array
{
return [];