Partage d'export enregistré et génération asynchrone des exports

This commit is contained in:
2025-07-08 13:53:25 +00:00
parent c4cc0baa8e
commit 8bc16dadb0
447 changed files with 14134 additions and 3854 deletions

View File

@@ -12,25 +12,42 @@ declare(strict_types=1);
namespace Chill\MainBundle\Export;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Contracts\Translation\TranslatableInterface;
/**
* Interface for Aggregators.
*
* Aggregators gather result of a query. Most of the time, it will add
* a GROUP BY clause.
*
* @template D of array
*/
interface AggregatorInterface extends ModifierInterface
{
/**
* Add a form to collect data from the user.
*/
public function buildForm(FormBuilderInterface $builder);
public function buildForm(FormBuilderInterface $builder): void;
/**
* Get the default data, that can be use as "data" for the form.
*
* @return D
*/
public function getFormDefaultData(): array;
/**
* @param D $formData
*/
public function normalizeFormData(array $formData): array;
/**
* @return D
*/
public function denormalizeFormData(array $formData, int $fromVersion): array;
public function getNormalizationVersion(): int;
/**
* get a callable which will be able to transform the results into
* viewable and understable string.
@@ -74,9 +91,9 @@ interface AggregatorInterface extends ModifierInterface
* @param string $key The column key, as added in the query
* @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')
*
* @return \Closure 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(mixed $value): (string|int|\DateTimeInterface|TranslatableInterface) 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, mixed $data);
public function getLabels(string $key, array $values, mixed $data): callable;
/**
* give the list of keys the current export added to the queryBuilder in
@@ -85,7 +102,9 @@ interface AggregatorInterface extends ModifierInterface
* Example: if your query builder will contains `SELECT count(id) AS count_id ...`,
* this function will return `array('count_id')`.
*
* @param mixed[] $data the data from the export's form (added by self::buildForm)
* @param D $data the data from the export's form (added by self::buildForm)
*
* @return list<string>
*/
public function getQueryKeys($data);
public function getQueryKeys(array $data): array;
}