Skip to content

Commit

Permalink
Don't embed metadata in publications
Browse files Browse the repository at this point in the history
  • Loading branch information
rjzondervan committed Aug 16, 2024
1 parent 342d7c4 commit d921350
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 23 deletions.
2 changes: 1 addition & 1 deletion lib/Db/Publication.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public function jsonSerialize(): array
'data' => $this->data,
'attachments' => $this->attachments,
'attachmentCount' => $this->attachmentCount,
'schema' => json_decode($this->schema, true),
'schema' => $this->schema,
'status' => $this->status,
'license' => $this->license,
'themes' => $this->themes,
Expand Down
22 changes: 0 additions & 22 deletions lib/Db/PublicationMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,29 +87,7 @@ protected function mapRowToEntityCustom(array $row): Entity {
}
}

// Map the MetaData fields to a sub-array
$metaDataData = [
'id' => $row['metadata_id'] ?? null,
'title' => $row['metadata_title'] ?? null,
'version' => $row['metadata_version'] ?? null,
'description' => $row['metadata_description'] ?? null,
'required' => $row['metadata_required'] ?? null,
'properties' => $row['metadata_properties'] ?? null,
];

$metaDataIsEmpty = true;
foreach ($metaDataData as $key => $value) {
if ($value !== null) {
$metaDataIsEmpty = false;
}

if (array_key_exists("metadata_$key", $row) === true) {
unset($row["metadata_$key"]);
}
}

$row['catalogi'] = $catalogiIsEmpty === true ? null : json_encode(Catalog::fromRow($catalogiData)->jsonSerialize());
$row['metaData'] = $metaDataIsEmpty === true ? null : json_encode(MetaData::fromRow($metaDataData)->jsonSerialize());

return \call_user_func($this->entityClass .'::fromRow', $row);
}
Expand Down

0 comments on commit d921350

Please sign in to comment.