mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-28 10:33:49 +00:00
rewrite export controller and manager
- upgrade to symfony 4 ; - add support for directExportInterface
This commit is contained in:
@@ -148,12 +148,18 @@ class ExportManager
|
||||
*
|
||||
* @internal used by DI
|
||||
*
|
||||
* @param ExportInterface $export
|
||||
* @param ExportInterface|DirectExportInterface $export
|
||||
* @param type $alias
|
||||
*/
|
||||
public function addExport(ExportInterface $export, $alias)
|
||||
public function addExport($export, $alias)
|
||||
{
|
||||
$this->exports[$alias] = $export;
|
||||
if ($export instanceof ExportInterface || $export instanceof DirectExportInterface) {
|
||||
$this->exports[$alias] = $export;
|
||||
} else {
|
||||
throw new \InvalidArgumentException(sprintf("The export with alias %s "
|
||||
. "does not implements %s or %s.", $alias, ExportInterface::class,
|
||||
DirectExportInterface::class));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -426,6 +432,11 @@ class ExportManager
|
||||
//$qb = $this->em->createQueryBuilder();
|
||||
$centers = $this->getPickedCenters($pickedCentersData);
|
||||
|
||||
if ($export instanceof DirectExportInterface) {
|
||||
return $export->generate($this->buildCenterReachableScopes($centers, $export),
|
||||
$data[ExportType::EXPORT_KEY]);
|
||||
}
|
||||
|
||||
$query = $export->initiateQuery(
|
||||
$this->retrieveUsedModifiers($data),
|
||||
$this->buildCenterReachableScopes($centers, $export),
|
||||
|
Reference in New Issue
Block a user