mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-25 00:53:48 +00:00
Add new normalization methods on filters, aggregators exports and formatter by applying rector rule
This commit is contained in:
@@ -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()];
|
||||
|
@@ -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 [];
|
||||
|
Reference in New Issue
Block a user