mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-28 02:23:51 +00:00
Adapt export list events to new export features
This commit is contained in:
@@ -18,18 +18,22 @@ use Chill\EventBundle\Repository\EventBudgetElementRepository;
|
|||||||
use Chill\EventBundle\Repository\EventThemeRepository;
|
use Chill\EventBundle\Repository\EventThemeRepository;
|
||||||
use Chill\EventBundle\Security\EventVoter;
|
use Chill\EventBundle\Security\EventVoter;
|
||||||
use Chill\EventBundle\Templating\Entity\EventThemeRender;
|
use Chill\EventBundle\Templating\Entity\EventThemeRender;
|
||||||
|
use Chill\MainBundle\Export\ExportGenerationContext;
|
||||||
use Chill\MainBundle\Export\FormatterInterface;
|
use Chill\MainBundle\Export\FormatterInterface;
|
||||||
use Chill\MainBundle\Export\GroupedExportInterface;
|
use Chill\MainBundle\Export\GroupedExportInterface;
|
||||||
use Chill\MainBundle\Export\ListInterface;
|
use Chill\MainBundle\Export\ListInterface;
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||||
use Chill\ThirdPartyBundle\Export\Helper\LabelThirdPartyHelper;
|
use Chill\ThirdPartyBundle\Export\Helper\LabelThirdPartyHelper;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use Doctrine\ORM\NativeQuery;
|
||||||
use Doctrine\ORM\Query;
|
use Doctrine\ORM\Query;
|
||||||
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\Validator\Constraints\Callback;
|
use Symfony\Component\Validator\Constraints\Callback;
|
||||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||||
|
use Symfony\Contracts\Translation\TranslatableInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render a list of events.
|
* Render a list of events.
|
||||||
@@ -65,7 +69,7 @@ class ListEvents implements ListInterface, GroupedExportInterface
|
|||||||
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
|
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder): void
|
||||||
{
|
{
|
||||||
$builder
|
$builder
|
||||||
->add('fields', ChoiceType::class, [
|
->add('fields', ChoiceType::class, [
|
||||||
@@ -203,27 +207,27 @@ class ListEvents implements ListInterface, GroupedExportInterface
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getQueryKeys($data)
|
public function getQueryKeys(array $data): array
|
||||||
{
|
{
|
||||||
return $data['fields'];
|
return $data['fields'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getResult($query, $data)
|
public function getResult($query, $data, ExportGenerationContext $context): array
|
||||||
{
|
{
|
||||||
return $query->getQuery()->getResult(Query::HYDRATE_SCALAR);
|
return $query->getQuery()->getResult(Query::HYDRATE_SCALAR);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTitle()
|
public function getTitle(): string|TranslatableInterface
|
||||||
{
|
{
|
||||||
return 'export.event.list.title';
|
return 'export.event.list.title';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getType()
|
public function getType(): string
|
||||||
{
|
{
|
||||||
return Declarations::EVENT;
|
return Declarations::EVENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
|
public function initiateQuery(array $requiredModifiers, array $acl, array $data, ExportGenerationContext $context): NativeQuery|QueryBuilder
|
||||||
{
|
{
|
||||||
$centers = array_map(static fn ($el) => $el['center'], $acl);
|
$centers = array_map(static fn ($el) => $el['center'], $acl);
|
||||||
|
|
||||||
@@ -355,4 +359,19 @@ class ListEvents implements ListInterface, GroupedExportInterface
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return ['fields' => $formData['fields']];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return ['fields' => $formData['fields']];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user