Skip to content

Commit

Permalink
Do not use internal storage for export links
Browse files Browse the repository at this point in the history
  • Loading branch information
dnna committed Sep 8, 2018
1 parent 2655f1a commit 648f8b4
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions src/Listener/ExportButtonGridListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ final class ExportButtonGridListener
*/
private $formats;

/**
* @var array[]
*/
private $links = [];

/**
* @param string[] $formats
*/
Expand Down Expand Up @@ -79,16 +74,15 @@ public function onSyliusGridAdmin(GridDefinitionConverterEvent $event)
*/
private function createLinks(): array
{
if (empty($this->links)) {
foreach ($this->formats as $format) {
$this->addLink($format);
}
$links = [];
foreach ($this->formats as $format) {
$links[] = $this->addLink($format);
}

return $this->links;
return $links;
}

private function addLink(string $format): void
private function addLink(string $format): array
{
$parameters = [
'resource' => $this->resource,
Expand All @@ -101,7 +95,7 @@ private function addLink(string $format): void
$parameters['criteria'] = $currentRequest->query->get('criteria');
}

$this->links[$format] = [
return [
'label' => 'fos.import_export.ui.types.' . $format,
'icon' => 'file archive',
'route' => 'app_export_data',
Expand Down

0 comments on commit 648f8b4

Please sign in to comment.