mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-03-19 21:59:00 +01:00
Improved EntityExporter to handle recursive exports
This commit is contained in:
@@ -51,7 +51,7 @@ class StructuralElementNormalizer implements NormalizerInterface
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function normalize($object, string $format = null, array $context = []): array
|
||||
public function normalize($object, string $format = null, array $context = []): mixed
|
||||
{
|
||||
if (!$object instanceof AbstractStructuralDBElement) {
|
||||
throw new \InvalidArgumentException('This normalizer only supports AbstractStructural objects!');
|
||||
@@ -59,6 +59,10 @@ class StructuralElementNormalizer implements NormalizerInterface
|
||||
|
||||
$data = $this->normalizer->normalize($object, $format, $context);
|
||||
|
||||
if (!is_array($data)) {
|
||||
return $data;
|
||||
}
|
||||
|
||||
//Remove type field for CSV export
|
||||
if ($format === 'csv') {
|
||||
unset($data['type']);
|
||||
|
||||
Reference in New Issue
Block a user