Skip to content

Commit

Permalink
FEATURE: Add support for ressource columns
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin-K committed Jun 5, 2018
1 parent 9b376d4 commit 3a4533d
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion Classes/Controller/DatabaseStorageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -55,6 +57,12 @@ class DatabaseStorageController extends ActionController
*/
protected $databaseStorageRepository;

/**
* @Flow\Inject
* @var ResourceManager
*/
protected $resourceManager;

/**
* @var array
*/
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 3a4533d

Please sign in to comment.