diff --git a/src/Symfony/Component/Serializer/CHANGELOG.md b/src/Symfony/Component/Serializer/CHANGELOG.md index ef59f22499264..9e48c5c41e927 100644 --- a/src/Symfony/Component/Serializer/CHANGELOG.md +++ b/src/Symfony/Component/Serializer/CHANGELOG.md @@ -7,6 +7,7 @@ CHANGELOG * added `AbstractObjectNormalizer::DISABLE_TYPE_ENFORCEMENT` context option to disable throwing an `UnexpectedValueException` on a type mismatch * added support for serializing `DateInterval` objects + * added getter for extra attributes in `ExtraAttributesException` 3.3.0 ----- diff --git a/src/Symfony/Component/Serializer/Exception/ExtraAttributesException.php b/src/Symfony/Component/Serializer/Exception/ExtraAttributesException.php index d321618b8eb11..74d87f87f5e8d 100644 --- a/src/Symfony/Component/Serializer/Exception/ExtraAttributesException.php +++ b/src/Symfony/Component/Serializer/Exception/ExtraAttributesException.php @@ -18,10 +18,24 @@ */ class ExtraAttributesException extends RuntimeException { + private $extraAttributes; + public function __construct(array $extraAttributes, \Exception $previous = null) { $msg = sprintf('Extra attributes are not allowed ("%s" are unknown).', implode('", "', $extraAttributes)); + $this->extraAttributes = $extraAttributes; + parent::__construct($msg, 0, $previous); } + + /** + * Get the extra attributes that are not allowed. + * + * @return array + */ + public function getExtraAttributes() + { + return $this->extraAttributes; + } }
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: