From 648f8b447ef8ebeaa2475344e7d222a44f7f1ed7 Mon Sep 17 00:00:00 2001 From: dnna Date: Sat, 8 Sep 2018 16:33:25 +0300 Subject: [PATCH] Do not use internal storage for export links --- src/Listener/ExportButtonGridListener.php | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/Listener/ExportButtonGridListener.php b/src/Listener/ExportButtonGridListener.php index b922480b..4f4e2b0a 100644 --- a/src/Listener/ExportButtonGridListener.php +++ b/src/Listener/ExportButtonGridListener.php @@ -26,11 +26,6 @@ final class ExportButtonGridListener */ private $formats; - /** - * @var array[] - */ - private $links = []; - /** * @param string[] $formats */ @@ -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, @@ -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',