From 3a4533dd94398d9d8a91b9e596e3a98c33e2da9d Mon Sep 17 00:00:00 2001 From: Benjamin Klix Date: Tue, 5 Jun 2018 12:25:20 +0200 Subject: [PATCH] FEATURE: Add support for ressource columns --- Classes/Controller/DatabaseStorageController.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Classes/Controller/DatabaseStorageController.php b/Classes/Controller/DatabaseStorageController.php index 412a20c..be376b4 100644 --- a/Classes/Controller/DatabaseStorageController.php +++ b/Classes/Controller/DatabaseStorageController.php @@ -7,6 +7,8 @@ use Neos\Flow\Annotations as Flow; use Neos\Flow\Mvc\Controller\ActionController; +use Neos\Flow\ResourceManagement\ResourceManager; +use Neos\Flow\ResourceManagement\PersistentResource; use Wegmeister\DatabaseStorage\Domain\Repository\DatabaseStorageRepository; @@ -55,6 +57,12 @@ class DatabaseStorageController extends ActionController */ protected $databaseStorageRepository; + /** + * @Flow\Inject + * @var ResourceManager + */ + protected $resourceManager; + /** * @var array */ @@ -150,7 +158,13 @@ public function exportAction(string $identifier, $writerType = 'Xlsx') $values = []; foreach ($entry->getProperties() as $value) { - $values[] = $value; + if ($value instanceof PersistentResource) { + $values[] = $this->resourceManager->getPublicPersistentResourceUri($value) ?: '-'; + } elseif (is_string($value)) { + $values[] = $value; + } elseif (is_object($value) && method_exists($value, '__toString')) { + $values[] = (string)$value; + } } $dataArray[] = $values;