Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / modules / serialization / src / Normalizer / ContentEntityNormalizer.php
index d3abef6f128a7d07ad258b3665bf792b55f46d82..85635a92a20e5259d8be816701d914dea2d23f7e 100644 (file)
@@ -2,6 +2,8 @@
 
 namespace Drupal\serialization\Normalizer;
 
+use Drupal\Core\TypedData\TypedDataInternalPropertiesHelper;
+
 /**
  * Normalizes/denormalizes Drupal content entities into an array structure.
  */
@@ -21,7 +23,8 @@ class ContentEntityNormalizer extends EntityNormalizer {
     ];
 
     $attributes = [];
-    foreach ($entity as $name => $field_items) {
+    /** @var \Drupal\Core\Entity\Entity $entity */
+    foreach (TypedDataInternalPropertiesHelper::getNonInternalProperties($entity->getTypedData()) as $name => $field_items) {
       if ($field_items->access('view', $context['account'])) {
         $attributes[$name] = $this->serializer->normalize($field_items, $format, $context);
       }