Merge remote-tracking branch 'origin/master' into rector/rules-up-to-php80

Conflicts:
	src/Bundle/ChillActivityBundle/Controller/ActivityController.php
	src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/DateAggregator.php
	src/Bundle/ChillActivityBundle/Menu/PersonMenuBuilder.php
	src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php
	src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php
	src/Bundle/ChillCalendarBundle/Command/MapAndSubscribeUserCalendarCommand.php
	src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MSGraphUserRepository.php
	src/Bundle/ChillDocStoreBundle/Controller/DocumentAccompanyingCourseController.php
	src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php
	src/Bundle/ChillDocStoreBundle/Repository/PersonDocumentACLAwareRepository.php
	src/Bundle/ChillEventBundle/Search/EventSearch.php
	src/Bundle/ChillMainBundle/Controller/ExportController.php
	src/Bundle/ChillMainBundle/Controller/PermissionsGroupController.php
	src/Bundle/ChillMainBundle/Cron/CronManager.php
	src/Bundle/ChillMainBundle/Entity/CronJobExecution.php
	src/Bundle/ChillMainBundle/Export/ExportManager.php
	src/Bundle/ChillMainBundle/Form/Type/Export/PickCenterType.php
	src/Bundle/ChillMainBundle/Form/Type/Listing/FilterOrderType.php
	src/Bundle/ChillMainBundle/Repository/NotificationRepository.php
	src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php
	src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperBuilder.php
	src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperFactory.php
	src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php
	src/Bundle/ChillPersonBundle/Controller/SocialWorkSocialActionApiController.php
	src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/AgeAggregator.php
	src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriod.php
	src/Bundle/ChillPersonBundle/Export/Export/ListHouseholdInPeriod.php
	src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepository.php
	src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodVoter.php
	src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodContext.php
	src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodWorkEvaluationContext.php
	src/Bundle/ChillPersonBundle/Service/DocGenerator/PersonContext.php
	src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadReports.php
	src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php
This commit is contained in:
2023-07-17 12:49:13 +02:00
544 changed files with 18622 additions and 2105 deletions

View File

@@ -12,6 +12,7 @@ declare(strict_types=1);
namespace Chill\MainBundle\Export;
use Closure;
use Symfony\Component\Form\FormBuilderInterface;
/**
* Interface for Aggregators.
@@ -21,6 +22,16 @@ use Closure;
*/
interface AggregatorInterface extends ModifierInterface
{
/**
* Add a form to collect data from the user.
*/
public function buildForm(FormBuilderInterface $builder);
/**
* Get the default data, that can be use as "data" for the form
*/
public function getFormDefaultData(): array;
/**
* get a callable which will be able to transform the results into
* viewable and understable string.

View File

@@ -11,10 +11,21 @@ declare(strict_types=1);
namespace Chill\MainBundle\Export;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\HttpFoundation\Response;
interface DirectExportInterface extends ExportElementInterface
{
/**
* Add a form to collect data from the user.
*/
public function buildForm(FormBuilderInterface $builder);
/**
* Get the default data, that can be use as "data" for the form
*/
public function getFormDefaultData(): array;
/**
* Generate the export.
*/

View File

@@ -19,11 +19,6 @@ use Symfony\Component\Form\FormBuilderInterface;
*/
interface ExportElementInterface
{
/**
* Add a form to collect data from the user.
*/
public function buildForm(FormBuilderInterface $builder);
/**
* get a title, which will be used in UI (and translated).
*

View File

@@ -0,0 +1,171 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\MainBundle\Export;
use Chill\MainBundle\Entity\SavedExport;
use Chill\MainBundle\Form\Type\Export\ExportType;
use Chill\MainBundle\Form\Type\Export\FilterType;
use Chill\MainBundle\Form\Type\Export\FormatterType;
use Chill\MainBundle\Form\Type\Export\PickCenterType;
use Chill\MainBundle\Security\Authorization\AuthorizationHelperForCurrentUserInterface;
use Symfony\Component\Form\Extension\Core\Type\FormType;
use Symfony\Component\Form\FormFactoryInterface;
final readonly class ExportFormHelper
{
public function __construct(
private AuthorizationHelperForCurrentUserInterface $authorizationHelper,
private ExportManager $exportManager,
private FormFactoryInterface $formFactory,
) {
}
public function getDefaultData(string $step, ExportInterface|DirectExportInterface $export, array $options = []): array
{
return match ($step) {
'centers', 'generate_centers' => ['centers' => $this->authorizationHelper->getReachableCenters($export->requiredRole())],
'export', 'generate_export' => ['export' => $this->getDefaultDataStepExport($export, $options)],
'formatter', 'generate_formatter' => ['formatter' => $this->getDefaultDataStepFormatter($options)],
default => throw new \LogicException("step not allowed : " . $step),
};
}
private function getDefaultDataStepFormatter(array $options): array
{
$formatter = $this->exportManager->getFormatter($options['formatter_alias']);
return $formatter->getFormDefaultData($options['aggregator_aliases']);
}
private function getDefaultDataStepExport(ExportInterface|DirectExportInterface $export, array $options): array
{
$data = [
ExportType::EXPORT_KEY => $export->getFormDefaultData(),
ExportType::FILTER_KEY => [],
ExportType::AGGREGATOR_KEY => [],
ExportType::PICK_FORMATTER_KEY => [],
];
$filters = $this->exportManager->getFiltersApplyingOn($export, $options['picked_centers']);
foreach ($filters as $alias => $filter) {
$data[ExportType::FILTER_KEY][$alias] = [
FilterType::ENABLED_FIELD => false,
'form' => $filter->getFormDefaultData()
];
}
$aggregators = $this->exportManager
->getAggregatorsApplyingOn($export, $options['picked_centers']);
foreach ($aggregators as $alias => $aggregator) {
$data[ExportType::AGGREGATOR_KEY][$alias] = [
'enabled' => false,
'form' => $aggregator->getFormDefaultData(),
];
}
if ($export instanceof ExportInterface) {
$allowedFormatters = $this->exportManager
->getFormattersByTypes($export->getAllowedFormattersTypes());
$choices = [];
foreach (array_keys(iterator_to_array($allowedFormatters)) as $alias) {
$choices[] = $alias;
}
$data[ExportType::PICK_FORMATTER_KEY]['alias'] = match (count($choices)) {
1 => $choices[0],
default => null,
};
} else {
unset($data[ExportType::PICK_FORMATTER_KEY]);
}
return $data;
}
public function savedExportDataToFormData(
SavedExport $savedExport,
string $step,
array $formOptions = [],
): array {
return match ($step) {
'centers', 'generate_centers' => $this->savedExportDataToFormDataStepCenter($savedExport),
'export', 'generate_export' => $this->savedExportDataToFormDataStepExport($savedExport, $formOptions),
'formatter', 'generate_formatter' => $this->savedExportDataToFormDataStepFormatter($savedExport, $formOptions),
default => throw new \LogicException("this step is not allowed: " . $step),
};
}
private function savedExportDataToFormDataStepCenter(
SavedExport $savedExport,
): array {
$builder = $this->formFactory
->createBuilder(
FormType::class,
[],
[
'csrf_protection' => false,
]
);
$builder->add('centers', PickCenterType::class, [
'export_alias' => $savedExport->getExportAlias(),
]);
$form = $builder->getForm();
$form->submit($savedExport->getOptions()['centers']);
return $form->getData();
}
private function savedExportDataToFormDataStepExport(
SavedExport $savedExport,
array $formOptions
): array {
$builder = $this->formFactory
->createBuilder(
FormType::class,
[],
[
'csrf_protection' => false,
]
);
$builder->add('export', ExportType::class, [
'export_alias' => $savedExport->getExportAlias(), ...$formOptions
]);
$form = $builder->getForm();
$form->submit($savedExport->getOptions()['export']);
return $form->getData();
}
private function savedExportDataToFormDataStepFormatter(
SavedExport $savedExport,
array $formOptions
): array {
$builder = $this->formFactory
->createBuilder(
FormType::class,
[],
[
'csrf_protection' => false,
]
);
$builder->add('formatter', FormatterType::class, [
'export_alias' => $savedExport->getExportAlias(), ...$formOptions
]);
$form = $builder->getForm();
$form->submit($savedExport->getOptions()['formatter']);
return $form->getData();
}
}

View File

@@ -13,6 +13,7 @@ namespace Chill\MainBundle\Export;
use Doctrine\ORM\NativeQuery;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
/**
* Interface for Export.
@@ -28,6 +29,16 @@ use Doctrine\ORM\QueryBuilder;
*/
interface ExportInterface extends ExportElementInterface
{
/**
* Add a form to collect data from the user.
*/
public function buildForm(FormBuilderInterface $builder);
/**
* Get the default data, that can be use as "data" for the form
*/
public function getFormDefaultData(): array;
/**
* Return which formatter type is allowed for this report.
*
@@ -86,7 +97,7 @@ interface ExportInterface extends ExportElementInterface
* @param mixed[] $values The values from the result. if there are duplicates, those might be given twice. Example: array('FR', 'BE', 'CZ', 'FR', 'BE', 'FR')
* @param mixed $data The data from the export's form (as defined in `buildForm`)
*
* @return callable(null|string|int|float|'_header' $value): string|int|\DateTimeInterface where the first argument is the value, and the function should return the label to show in the formatted file. Example : `function($countryCode) use ($countries) { return $countries[$countryCode]->getName(); }`
* @return (callable(null|string|int|float|'_header' $value): string|int|\DateTimeInterface) where the first argument is the value, and the function should return the label to show in the formatted file. Example : `function($countryCode) use ($countries) { return $countries[$countryCode]->getName(); }`
*/
public function getLabels($key, array $values, $data);

View File

@@ -12,7 +12,6 @@ declare(strict_types=1);
namespace Chill\MainBundle\Export;
use Chill\MainBundle\Form\Type\Export\ExportType;
use Chill\MainBundle\Form\Type\Export\PickCenterType;
use Chill\MainBundle\Security\Authorization\AuthorizationHelperInterface;
use Doctrine\ORM\QueryBuilder;
use Generator;
@@ -44,6 +43,10 @@ class ExportManager
*/
private array $aggregators = [];
private AuthorizationCheckerInterface $authorizationChecker;
private AuthorizationHelperInterface $authorizationHelper;
/**
* Collected Exports, injected by DI.
*
@@ -65,15 +68,17 @@ class ExportManager
*/
private array $formatters = [];
private LoggerInterface $logger;
/**
* @var \Symfony\Component\Security\Core\User\UserInterface
*/
private $user;
public function __construct(
private LoggerInterface $logger,
private AuthorizationCheckerInterface $authorizationChecker,
private AuthorizationHelperInterface $authorizationHelper,
LoggerInterface $logger,
AuthorizationCheckerInterface $authorizationChecker,
AuthorizationHelperInterface $authorizationHelper,
TokenStorageInterface $tokenStorage,
iterable $exports,
iterable $aggregators,
@@ -81,6 +86,9 @@ class ExportManager
//iterable $formatters,
//iterable $exportElementProvider
) {
$this->logger = $logger;
$this->authorizationChecker = $authorizationChecker;
$this->authorizationHelper = $authorizationHelper;
$this->user = $tokenStorage->getToken()->getUser();
$this->exports = iterator_to_array($exports);
$this->aggregators = iterator_to_array($aggregators);
@@ -105,8 +113,12 @@ class ExportManager
*
* @return FilterInterface[] a \Generator that contains filters. The key is the filter's alias
*/
public function &getFiltersApplyingOn(ExportInterface $export, ?array $centers = null)
public function &getFiltersApplyingOn(ExportInterface|DirectExportInterface $export, ?array $centers = null): iterable
{
if ($export instanceof DirectExportInterface) {
return;
}
foreach ($this->filters as $alias => $filter) {
if (
in_array($filter->applyOn(), $export->supportsModifiers(), true)
@@ -122,11 +134,11 @@ class ExportManager
*
* @internal This class check the interface implemented by export, and, if ´ListInterface´ is used, return an empty array
*
* @return AggregatorInterface[] a \Generator that contains aggretagors. The key is the filter's alias
* @return null|iterable<string, AggregatorInterface> a \Generator that contains aggretagors. The key is the filter's alias
*/
public function &getAggregatorsApplyingOn(ExportInterface $export, ?array $centers = null)
public function &getAggregatorsApplyingOn(ExportInterface|DirectExportInterface $export, ?array $centers = null): ?iterable
{
if ($export instanceof ListInterface) {
if ($export instanceof ListInterface || $export instanceof DirectExportInterface) {
return;
}
@@ -140,7 +152,7 @@ class ExportManager
}
}
public function addExportElementsProvider(ExportElementsProviderInterface $provider, $prefix)
public function addExportElementsProvider(ExportElementsProviderInterface $provider, string $prefix): void
{
foreach ($provider->getExportElements() as $suffix => $element) {
$alias = $prefix . '_' . $suffix;
@@ -154,7 +166,7 @@ class ExportManager
} elseif ($element instanceof FormatterInterface) {
$this->addFormatter($element, $alias);
} else {
throw new LogicException('This element ' . $element::class . ' '
throw new LogicException('This element ' . get_class($element) . ' '
. 'is not an instance of export element');
}
}
@@ -164,23 +176,16 @@ class ExportManager
* add a formatter.
*
* @internal used by DI
*
* @param string $alias
*/
public function addFormatter(FormatterInterface $formatter, $alias)
public function addFormatter(FormatterInterface $formatter, string $alias)
{
$this->formatters[$alias] = $formatter;
}
/**
* Generate a response which contains the requested data.
*
* @param string $exportAlias
* @param mixed[] $data
*
* @return Response
*/
public function generate($exportAlias, array $pickedCentersData, array $data, array $formatterData)
public function generate(string $exportAlias, array $pickedCentersData, array $data, array $formatterData): Response
{
$export = $this->getExport($exportAlias);
$centers = $this->getPickedCenters($pickedCentersData);
@@ -279,7 +284,11 @@ class ExportManager
return $this->aggregators[$alias];
}
public function getAggregators(array $aliases)
/**
* @param array $aliases
* @return iterable<string, AggregatorInterface>
*/
public function getAggregators(array $aliases): iterable
{
foreach ($aliases as $alias) {
yield $alias => $this->getAggregator($alias);
@@ -287,9 +296,11 @@ class ExportManager
}
/**
* @return string[] the existing type for known exports
* Get the types for known exports
*
* @return list<string> the existing type for known exports
*/
public function getExistingExportsTypes()
public function getExistingExportsTypes(): array
{
$existingTypes = [];
@@ -308,10 +319,8 @@ class ExportManager
* @param string $alias
*
* @throws RuntimeException
*
* @return ExportInterface
*/
public function getExport($alias)
public function getExport($alias): ExportInterface|DirectExportInterface
{
if (!array_key_exists($alias, $this->exports)) {
throw new RuntimeException("The export with alias {$alias} is not known.");
@@ -325,9 +334,9 @@ class ExportManager
*
* @param bool $whereUserIsGranted if true (default), restrict to user which are granted the right to execute the export
*
* @return ExportInterface[] an array where export's alias are keys
* @return iterable<string, ExportInterface|DirectExportInterface> an array where export's alias are keys
*/
public function getExports($whereUserIsGranted = true)
public function getExports($whereUserIsGranted = true): iterable
{
foreach ($this->exports as $alias => $export) {
if ($whereUserIsGranted) {
@@ -345,9 +354,9 @@ class ExportManager
*
* @param bool $whereUserIsGranted
*
* @return array where keys are the groups's name and value is an array of exports
* @return array<string, array<string, ExportInterface|DirectExportInterface>> where keys are the groups's name and value is an array of exports
*/
public function getExportsGrouped($whereUserIsGranted = true): array
public function getExportsGrouped(bool $whereUserIsGranted = true): array
{
$groups = ['_' => []];
@@ -366,10 +375,8 @@ class ExportManager
* @param string $alias
*
* @throws RuntimeException if the filter is not known
*
* @return FilterInterface
*/
public function getFilter($alias)
public function getFilter(string $alias): FilterInterface
{
if (!array_key_exists($alias, $this->filters)) {
throw new RuntimeException("The filter with alias {$alias} is not known.");
@@ -381,16 +388,17 @@ class ExportManager
/**
* get all filters.
*
* @param Generator $aliases
* @param array<string> $aliases
* @return iterable<string, FilterInterface> $aliases
*/
public function getFilters(array $aliases)
public function getFilters(array $aliases): iterable
{
foreach ($aliases as $alias) {
yield $alias => $this->getFilter($alias);
}
}
public function getFormatter($alias)
public function getFormatter(string $alias): FormatterInterface
{
if (!array_key_exists($alias, $this->formatters)) {
throw new RuntimeException("The formatter with alias {$alias} is not known.");
@@ -405,7 +413,7 @@ class ExportManager
* @param array $data the data from the export form
* @string the formatter alias|null
*/
public function getFormatterAlias(array $data)
public function getFormatterAlias(array $data): ?string
{
if (array_key_exists(ExportType::PICK_FORMATTER_KEY, $data)) {
return $data[ExportType::PICK_FORMATTER_KEY]['alias'];
@@ -417,9 +425,9 @@ class ExportManager
/**
* Get all formatters which supports one of the given types.
*
* @return Generator
* @return iterable<string, FormatterInterface>
*/
public function getFormattersByTypes(array $types)
public function getFormattersByTypes(array $types): iterable
{
foreach ($this->formatters as $alias => $formatter) {
if (in_array($formatter->getType(), $types, true)) {
@@ -436,7 +444,7 @@ class ExportManager
*
* @return \Chill\MainBundle\Entity\Center[] the picked center
*/
public function getPickedCenters(array $data)
public function getPickedCenters(array $data): array
{
return $data;
}
@@ -446,9 +454,9 @@ class ExportManager
*
* @param array $data the data from the export form
*
* @return string[]
* @return list<string>
*/
public function getUsedAggregatorsAliases(array $data)
public function getUsedAggregatorsAliases(array $data): array
{
$aggregators = $this->retrieveUsedAggregators($data[ExportType::AGGREGATOR_KEY]);
@@ -459,10 +467,11 @@ class ExportManager
* Return true if the current user has access to the ExportElement for every
* center, false if the user hasn't access to element for at least one center.
*
* @param \Chill\MainBundle\Export\ExportElementInterface $element
* @param DirectExportInterface|ExportInterface $export
*
* @return bool
*/
public function isGrantedForElement(ExportElementInterface $element, \Chill\MainBundle\Export\DirectExportInterface|\Chill\MainBundle\Export\ExportInterface $export = null, ?array $centers = null)
public function isGrantedForElement(ExportElementInterface $element, ?ExportElementInterface $export = null, ?array $centers = null): bool
{
if ($element instanceof ExportInterface || $element instanceof DirectExportInterface) {
$role = $element->requiredRole();
@@ -495,7 +504,7 @@ class ExportManager
//debugging
$this->logger->debug('user has no access to element', [
'method' => __METHOD__,
'type' => $element::class,
'type' => get_class($element),
'center' => $center->getName(),
'role' => $role,
]);
@@ -537,13 +546,12 @@ class ExportManager
* Check for acl. If an user is not authorized to see an aggregator, throw an
* UnauthorizedException.
*
* @param type $data
* @throw UnauthorizedHttpException if the user is not authorized
*/
private function handleAggregators(
ExportInterface $export,
QueryBuilder $qb,
$data,
array $data,
array $center
) {
$aggregators = $this->retrieveUsedAggregators($data);
@@ -566,7 +574,7 @@ class ExportManager
private function handleFilters(
ExportInterface $export,
QueryBuilder $qb,
mixed $data,
$data,
array $centers
) {
$filters = $this->retrieveUsedFilters($data);
@@ -587,9 +595,11 @@ class ExportManager
}
/**
* @return AggregatorInterface[]
* @param mixed $data
*
* @return iterable<string, AggregatorInterface>
*/
private function retrieveUsedAggregators(mixed $data)
private function retrieveUsedAggregators($data): iterable
{
if (null === $data) {
return [];
@@ -603,9 +613,11 @@ class ExportManager
}
/**
* @param mixed $data
*
* @return string[]
*/
private function retrieveUsedAggregatorsType(mixed $data)
private function retrieveUsedAggregatorsType($data)
{
if (null === $data) {
return [];
@@ -645,7 +657,7 @@ class ExportManager
*
* @return array an array with types
*/
private function retrieveUsedFiltersType(mixed $data)
private function retrieveUsedFiltersType($data)
{
if (null === $data) {
return [];
@@ -669,10 +681,11 @@ class ExportManager
/**
* parse the data to retrieve the used filters and aggregators.
*
* @param mixed $data
*
* @return string[]
*/
private function retrieveUsedModifiers(mixed $data)
private function retrieveUsedModifiers($data)
{
if (null === $data) {
return [];

View File

@@ -11,6 +11,8 @@ declare(strict_types=1);
namespace Chill\MainBundle\Export;
use Symfony\Component\Form\FormBuilderInterface;
/**
* Interface for filters.
*
@@ -23,6 +25,16 @@ interface FilterInterface extends ModifierInterface
{
public const STRING_FORMAT = 'string';
/**
* Add a form to collect data from the user.
*/
public function buildForm(FormBuilderInterface $builder);
/**
* Get the default data, that can be use as "data" for the form
*/
public function getFormDefaultData(): array;
/**
* Describe the filtering action.
*

View File

@@ -83,6 +83,11 @@ class CSVFormatter implements FormatterInterface
}
}
public function getFormDefaultData(array $aggregatorAliases): array
{
return [];
}
public function gatherFiltersDescriptions()
{
$descriptions = [];

View File

@@ -85,10 +85,14 @@ class CSVListFormatter implements FormatterInterface
'expanded' => true,
'multiple' => false,
'label' => 'Add a number on first column',
'data' => true,
]);
}
public function getFormDefaultData(array $aggregatorAliases): array
{
return ['numerotation' => true];
}
public function getName()
{
return 'CSV vertical list';

View File

@@ -84,6 +84,11 @@ class CSVPivotedListFormatter implements FormatterInterface
]);
}
public function getFormDefaultData(array $aggregatorAliases): array
{
return ['numerotation' => true];
}
public function getName()
{
return 'CSV horizontal list';

View File

@@ -173,7 +173,19 @@ class SpreadSheetFormatter implements FormatterInterface
}
}
public function getName()
public function getFormDefaultData(array $aggregatorAliases): array
{
$data = ['format' => 'xlsx'];
$aggregators = iterator_to_array($this->exportManager->getAggregators($aggregatorAliases));
foreach (array_keys($aggregators) as $index => $alias) {
$data[$alias] = ['order' => $index + 1];
}
return $data;
}
public function getName(): string
{
return 'SpreadSheet (xlsx, ods)';
}
@@ -185,7 +197,7 @@ class SpreadSheetFormatter implements FormatterInterface
array $exportData,
array $filtersData,
array $aggregatorsData
) {
): Response {
// store all data when the process is initiated
$this->result = $result;
$this->formatterData = $formatterData;
@@ -558,10 +570,8 @@ class SpreadSheetFormatter implements FormatterInterface
*
* This form allow to choose the aggregator position (row or column) and
* the ordering
*
* @param string $nbAggregators
*/
private function appendAggregatorForm(FormBuilderInterface $builder, $nbAggregators)
private function appendAggregatorForm(FormBuilderInterface $builder, int $nbAggregators): void
{
$builder->add('order', ChoiceType::class, [
'choices' => array_combine(

View File

@@ -104,10 +104,14 @@ class SpreadsheetListFormatter implements FormatterInterface
'expanded' => true,
'multiple' => false,
'label' => 'Add a number on first column',
'data' => true,
]);
}
public function getFormDefaultData(array $aggregatorAliases): array
{
return ['numerotation' => true, 'format' => 'xlsx'];
}
public function getName()
{
return 'Spreadsheet list formatter (.xlsx, .ods)';

View File

@@ -34,6 +34,11 @@ interface FormatterInterface
array $aggregatorAliases
);
/**
* get the default data for the form build by buildForm
*/
public function getFormDefaultData(array $aggregatorAliases): array;
public function getName();
/**