change FilterInterface::describeAction signature to include context

This commit is contained in:
2025-04-24 21:48:00 +02:00
parent 66c089e862
commit 176bff0551
116 changed files with 241 additions and 124 deletions

View File

@@ -81,8 +81,9 @@ interface FilterInterface extends ModifierInterface
* Example: `array('my string with %parameter%', ['%parameter%' => 'good news'], 'mydomain', 'mylocale')`
*
* @param D $data
* @param ExportGenerationContext $context
*
* @return array|string|TranslatableInterface a string with the data or, if translatable, an array where first element is string, second elements is an array of arguments
*/
public function describeAction(array $data): array|string|TranslatableInterface;
public function describeAction(array $data, ExportGenerationContext $context): array|string|TranslatableInterface;
}

View File

@@ -14,6 +14,7 @@ namespace Chill\MainBundle\Tests\Export;
use Chill\MainBundle\Entity\Center;
use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Export\AggregatorInterface;
use Chill\MainBundle\Export\ExportGenerationContext;
use Chill\MainBundle\Export\ExportInterface;
use Chill\MainBundle\Export\ExportManager;
use Chill\MainBundle\Export\FilterInterface;
@@ -390,7 +391,7 @@ class DummyFilterWithApplying implements FilterInterface
return [];
}
public function describeAction($data, $format = 'string'): string|\Symfony\Contracts\Translation\TranslatableInterface|array
public function describeAction($data, ExportGenerationContext $context, $format = 'string'): string|\Symfony\Contracts\Translation\TranslatableInterface|array
{
return ['dummy filter', []];
}

View File

@@ -12,6 +12,7 @@ declare(strict_types=1);
namespace Chill\MainBundle\Tests\Export;
use Chill\MainBundle\Export\AggregatorInterface;
use Chill\MainBundle\Export\ExportGenerationContext;
use Chill\MainBundle\Export\ExportManager;
use Chill\MainBundle\Export\FilterInterface;
use Chill\MainBundle\Export\SortExportElement;
@@ -207,7 +208,7 @@ class SortExportElementTest extends KernelTestCase
return [];
}
public function describeAction($data, $format = 'string'): string|TranslatableInterface|array
public function describeAction($data, ExportGenerationContext $context, $format = 'string'): string|TranslatableInterface|array
{
return ['a', []];
}