mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
Partage d'export enregistré et génération asynchrone des exports
This commit is contained in:
6
.changes/unreleased/DX-20250401-144728.yaml
Normal file
6
.changes/unreleased/DX-20250401-144728.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
kind: DX
|
||||
body: Allow TranslatableMessage in flash messages
|
||||
time: 2025-04-01T14:47:28.814268801+02:00
|
||||
custom:
|
||||
Issue: ""
|
||||
SchemaChange: No schema change
|
71
.changes/unreleased/DX-20250407-121010.yaml
Normal file
71
.changes/unreleased/DX-20250407-121010.yaml
Normal file
@@ -0,0 +1,71 @@
|
||||
kind: DX
|
||||
body: |
|
||||
Rewrite exports to run them asynchronously
|
||||
|
||||
changelog: |
|
||||
- Add new methods to serialize data using the rector rule
|
||||
- Remove all references to the Request in filters, aggregators, filters. Actually, the most frequent occurence is `$security->getUser()`.
|
||||
- Refactor manually the initializeQuery method
|
||||
- Remove the injection of ExportManager into the constructor of each export element:
|
||||
|
||||
```diff
|
||||
|
||||
- class MyFormatter implements FormatterInterface
|
||||
+ class MyFormatter implements FormatterInterface, \Chill\MainBundle\Export\ExportManagerAwareInterface
|
||||
{
|
||||
+ use \Chill\MainBundle\Export\Helper\ExportManagerAwareTrait;
|
||||
|
||||
- public function __construct(private ExportManager $exportmanager) {}
|
||||
|
||||
public function MyMethod(): void
|
||||
{
|
||||
- $this->exportManager->getFilter('alias');
|
||||
+ $this->getExportManager()->getFilter('alias');
|
||||
}
|
||||
}
|
||||
```
|
||||
- configure messenger to handle export in a queue:
|
||||
|
||||
```diff
|
||||
# config/packages/messenger.yaml
|
||||
framework:
|
||||
messenger:
|
||||
routing:
|
||||
+ 'Chill\MainBundle\Export\Messenger\ExportRequestGenerationMessage': priority
|
||||
```
|
||||
|
||||
- add missing methods to exports, aggregators, filters, formatter:
|
||||
|
||||
```php
|
||||
public function normalizeFormData(array $formData): array;
|
||||
|
||||
public function denormalizeFormData(array $formData, int $fromVersion): array;
|
||||
```
|
||||
|
||||
There are rector rules to generate those methods:
|
||||
|
||||
- `Chill\Utils\Rector\Rector\ChillBundleAddNormalizationMethodsOnExportRector`
|
||||
|
||||
See:
|
||||
|
||||
```php
|
||||
// upgrade chill exports
|
||||
$rectorConfig->rules([\Chill\Utils\Rector\Rector\ChillBundleAddNormalizationMethodsOnExportRector::class]);
|
||||
```
|
||||
|
||||
This rule will create most of the work necessary, but some manuals changes are still necessary:
|
||||
|
||||
- we must set manually the correct repository for method `denormalizeDoctrineEntity`;
|
||||
- when the form data contains some entities, and the form type is not one of EntityType::class, PickUserDynamicType::class, PickUserLocationType::class, PickThirdpartyDynamicType::class, Select2CountryType::class, then we must handle the normalization manually (using the `\Chill\MainBundle\Export\ExportDataNormalizerTrait`)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
time: 2025-04-07T12:10:10.682561327+02:00
|
||||
custom:
|
||||
Issue: ""
|
||||
SchemaChange: Add columns or tables
|
Reference in New Issue
Block a user