mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-28 02:23:51 +00:00
rewrite export controller and manager
- upgrade to symfony 4 ; - add support for directExportInterface
This commit is contained in:
15
Export/DirectExportInterface.php
Normal file
15
Export/DirectExportInterface.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/*
|
||||
*
|
||||
*/
|
||||
namespace Chill\MainBundle\Export;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
interface DirectExportInterface extends ExportElementInterface
|
||||
{
|
||||
//put your code here
|
||||
}
|
@@ -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