fix link-parent not-storable
This commit is contained in:
@@ -43,6 +43,30 @@ class AfterUpgrade
|
||||
'length' => 24,
|
||||
]);
|
||||
|
||||
$this->fixParent($metadata);
|
||||
|
||||
$metadata->save();
|
||||
}
|
||||
|
||||
private function fixParent(Metadata $metadata): void
|
||||
{
|
||||
foreach ($metadata->get(['entityDefs']) as $scope => $defs) {
|
||||
foreach ($metadata->get(['entityDefs', $scope, 'fields']) as $field => $fieldDefs) {
|
||||
$custom = $metadata->getCustom('entityDefs', $scope);
|
||||
|
||||
if (!$custom) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (
|
||||
($fieldDefs['type'] ?? null) === 'linkParent' &&
|
||||
($fieldDefs['notStorable'] ?? false)
|
||||
) {
|
||||
if ($custom?->fields?->$field?->notStorable) {
|
||||
$metadata->delete('entityDefs', $scope, "fields.{$field}.notStorable");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user