Skip to content

Commit

Permalink
Respect inherited values in DataObjectNormalizer
Browse files Browse the repository at this point in the history
  • Loading branch information
markus-moser committed Jan 22, 2024
1 parent 287d4ee commit bef7a47
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Service/Normalizer/DataObjectNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use Pimcore\Model\DataObject\AbstractObject;
use Pimcore\Model\DataObject\Concrete;
use Pimcore\Model\DataObject\Folder;
use Pimcore\Model\DataObject\Localizedfield;
use Pimcore\Normalizer\NormalizerInterface;

final class DataObjectNormalizer extends AbstractElementNormalizer
Expand Down Expand Up @@ -97,6 +98,11 @@ protected function normalizeSystemFields(AbstractObject $dataObject): array
*/
private function normalizeStandardFields(Concrete $dataObject): array
{
$inheritedValuesBackup = AbstractObject::doGetInheritedValues();
$fallbackLanguagesBackup = Localizedfield::doGetFallbackValues();
AbstractObject::setGetInheritedValues(true);
Localizedfield::setGetFallbackValues(true);

$result = [];

foreach ($dataObject->getClass()->getFieldDefinitions() as $key => $fieldDefinition) {
Expand All @@ -109,6 +115,9 @@ private function normalizeStandardFields(Concrete $dataObject): array
$result[$key] = $value;
}

AbstractObject::setGetInheritedValues($inheritedValuesBackup);
Localizedfield::setGetFallbackValues($fallbackLanguagesBackup);

return $result;
}
}

0 comments on commit bef7a47

Please sign in to comment.