faster spreadsheet exporter based on opensout and other export improvements (#5238)
This commit is contained in:
@@ -18,6 +18,7 @@ use App\Event\MetaDisplayEventInterface;
|
||||
use App\Event\ProjectMetaDisplayEvent;
|
||||
use App\Event\TimesheetMetaDisplayEvent;
|
||||
use App\Event\UserPreferenceDisplayEvent;
|
||||
use App\Export\ExportRendererInterface;
|
||||
use App\Project\ProjectStatisticService;
|
||||
use App\Repository\Query\ActivityQuery;
|
||||
use App\Repository\Query\CustomerQuery;
|
||||
@@ -29,29 +30,22 @@ use Symfony\Component\HttpFoundation\Response;
|
||||
use Twig\Environment;
|
||||
use Twig\Extension\SandboxExtension;
|
||||
|
||||
class HtmlRenderer
|
||||
class HtmlRenderer implements ExportRendererInterface
|
||||
{
|
||||
use RendererTrait;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $id = 'html';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $template = 'default.html.twig';
|
||||
private string $id = 'html';
|
||||
private string $template = 'default.html.twig';
|
||||
|
||||
public function __construct(
|
||||
protected Environment $twig,
|
||||
protected EventDispatcherInterface $dispatcher,
|
||||
private ProjectStatisticService $projectStatisticService,
|
||||
private ActivityStatisticService $activityStatisticService
|
||||
protected readonly Environment $twig,
|
||||
protected readonly EventDispatcherInterface $dispatcher,
|
||||
private readonly ProjectStatisticService $projectStatisticService,
|
||||
private readonly ActivityStatisticService $activityStatisticService
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param MetaDisplayEventInterface $event
|
||||
* @return MetaTableTypeInterface[]
|
||||
*/
|
||||
protected function findMetaColumns(MetaDisplayEventInterface $event): array
|
||||
@@ -75,11 +69,6 @@ class HtmlRenderer
|
||||
|
||||
/**
|
||||
* @param ExportableItem[] $timesheets
|
||||
* @param TimesheetQuery $query
|
||||
* @return Response
|
||||
* @throws \Twig\Error\LoaderError
|
||||
* @throws \Twig\Error\RuntimeError
|
||||
* @throws \Twig\Error\SyntaxError
|
||||
*/
|
||||
public function render(array $timesheets, TimesheetQuery $query): Response
|
||||
{
|
||||
@@ -123,22 +112,23 @@ class HtmlRenderer
|
||||
return '@export/' . $this->template;
|
||||
}
|
||||
|
||||
public function setTemplate(string $filename): HtmlRenderer
|
||||
public function setTemplate(string $filename): void
|
||||
{
|
||||
$this->template = $filename;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setId(string $id): HtmlRenderer
|
||||
public function setId(string $id): void
|
||||
{
|
||||
$this->id = $id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getId(): string
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'print';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user