mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-12 11:24:31 +02:00
Improved EntityExporter to handle recursive exports
This commit is contained in:
parent
f6e955b487
commit
bbf7222a6a
2 changed files with 26 additions and 1 deletions
|
@ -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']);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue