Security update for Core, with self-updated composer
[yaffs-website] / vendor / symfony / serializer / Mapping / AttributeMetadata.php
index 7a1d3db94a8096a3ca3822367e480ec958dfa2a2..b9daf5d25b82996f3ba3d129da73e4c083fee515 100644 (file)
@@ -36,6 +36,15 @@ class AttributeMetadata implements AttributeMetadataInterface
      */
     public $groups = array();
 
+    /**
+     * @var int|null
+     *
+     * @internal This property is public in order to reduce the size of the
+     *           class' serialized representation. Do not access it. Use
+     *           {@link getMaxDepth()} instead.
+     */
+    public $maxDepth;
+
     /**
      * Constructs a metadata for the given attribute.
      *
@@ -72,6 +81,22 @@ class AttributeMetadata implements AttributeMetadataInterface
         return $this->groups;
     }
 
+    /**
+     * {@inheritdoc}
+     */
+    public function setMaxDepth($maxDepth)
+    {
+        $this->maxDepth = $maxDepth;
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function getMaxDepth()
+    {
+        return $this->maxDepth;
+    }
+
     /**
      * {@inheritdoc}
      */
@@ -80,6 +105,11 @@ class AttributeMetadata implements AttributeMetadataInterface
         foreach ($attributeMetadata->getGroups() as $group) {
             $this->addGroup($group);
         }
+
+        // Overwrite only if not defined
+        if (null === $this->maxDepth) {
+            $this->maxDepth = $attributeMetadata->getMaxDepth();
+        }
     }
 
     /**
@@ -89,6 +119,6 @@ class AttributeMetadata implements AttributeMetadataInterface
      */
     public function __sleep()
     {
-        return array('name', 'groups');
+        return array('name', 'groups', 'maxDepth');
     }
 }