18 KiB
CHANGELOG
7.3
- Deprecate the
CompiledClassMetadataFactoryandCompiledClassMetadataCacheWarmerclasses - Register
NormalizerInterfaceandDenormalizerInterfacealiases for named serializers - Add
NumberNormalizerto normalizeBcMath\NumberandGMPasstring - Add
defaultTypetoDiscriminatorMap
7.2
- Deprecate the
csv_escape_charcontext option ofCsvEncoderand theCsvEncoder::ESCAPE_CHAR_KEYconstant - Deprecate
CsvEncoderContextBuilder::withEscapeChar()method - Add
SnakeCaseToCamelCaseNameConverter - Support subclasses of
\DateTimeand\DateTimeImmutablefor denormalization - Add the
UidNormalizer::NORMALIZATION_FORMAT_RFC9562constant - Add support for configuring multiple serializer instances with different default contexts, name converters, sets of normalizers and encoders
- Add support for collection profiles of multiple serializer instances
- Deprecate
AdvancedNameConverterInterface, useNameConverterInterfaceinstead
7.1
- Add arguments
$class,$formatand$contexttoNameConverterInterface::normalize()andNameConverterInterface::denormalize() - Add
DateTimeNormalizer::CAST_KEYcontext option - Add
Defaultand "class name" default groups - Add
AbstractNormalizer::FILTER_BOOLcontext option - Add
CamelCaseToSnakeCaseNameConverter::REQUIRE_SNAKE_CASE_PROPERTIEScontext option - Deprecate
AbstractNormalizerContextBuilder::withDefaultContructorArguments(?array $defaultContructorArguments), usewithDefaultConstructorArguments(?array $defaultConstructorArguments)instead (note the missingscharacter in Contructor word in deprecated method) - Add
XmlEncoder::CDATA_WRAPPING_PATTERNcontext option
7.0
- Add method
getSupportedTypes()toDenormalizerInterfaceandNormalizerInterface - Remove denormalization support for
AbstractUidinUidNormalizer, use one ofAbstractUidchild class instead - Denormalizing to an abstract class in
UidNormalizernow throws an\Error - Remove
ContextAwareDenormalizerInterface, useDenormalizerInterfaceinstead - Remove
ContextAwareNormalizerInterface, useNormalizerInterfaceinstead - Remove
CacheableSupportsMethodInterface, useNormalizerInterfaceandDenormalizerInterfaceinstead - Require explicit argument when calling
AttributeMetadata::setSerializedName()andClassMetadata::setClassDiscriminatorMapping() - Add argument
$contexttoNormalizerInterface::supportsNormalization()andDenormalizerInterface::supportsDenormalization() - Remove Doctrine annotations support in favor of native attributes
- Remove
AnnotationLoader, useAttributeLoaderinstead
6.4
- Add
TranslatableNormalizer - Allow
Contextattribute to target classes - Deprecate Doctrine annotations support in favor of native attributes
- Allow the
Groupsattribute/annotation on classes - JsonDecode: Add
json_decode_detailed_errorsoption - Make
ProblemNormalizergive details about Messenger'sValidationFailedException - Add
XmlEncoder::CDATA_WRAPPINGcontext option - Deprecate
AnnotationLoader, useAttributeLoaderinstead - Add aliases for all classes in the
Annotationnamespace toAttribute
6.3
- Add
AbstractNormalizer::REQUIRE_ALL_PROPERTIEScontext flag to require all properties to be listed in the input instead of falling back to null for nullable ones - Add
XmlEncoder::SAVE_OPTIONScontext option - Add
BackedEnumNormalizer::ALLOW_INVALID_VALUEScontext option - Add
UnsupportedFormatExceptionwhich is thrown when there is no decoder for a given format - Add method
getSupportedTypes(?string $format)toNormalizerInterfaceandDenormalizerInterface - Make
ProblemNormalizergive details aboutValidationFailedExceptionandPartialDenormalizationException - Deprecate
CacheableSupportsMethodInterfacein favor of the newgetSupportedTypes(?string $format)methods - The following Normalizer classes will become final in 7.0:
ConstraintViolationListNormalizerCustomNormalizerDataUriNormalizerDateIntervalNormalizerDateTimeNormalizerDateTimeZoneNormalizerGetSetMethodNormalizerJsonSerializableNormalizerObjectNormalizerPropertyNormalizer
6.2
- Add support for constructor promoted properties to
Contextattribute - Add context option
PropertyNormalizer::NORMALIZE_VISIBILITYwith bitmask flagsPropertyNormalizer::NORMALIZE_PUBLIC,PropertyNormalizer::NORMALIZE_PROTECTED,PropertyNormalizer::NORMALIZE_PRIVATE - Add method
withNormalizeVisibilitytoPropertyNormalizerContextBuilder - Deprecate calling
AttributeMetadata::setSerializedName(),ClassMetadata::setClassDiscriminatorMapping()without arguments - Change the signature of
AttributeMetadataInterface::setSerializedName()tosetSerializedName(?string) - Change the signature of
ClassMetadataInterface::setClassDiscriminatorMapping()tosetClassDiscriminatorMapping(?ClassDiscriminatorMapping) - Add option YamlEncoder::YAML_INDENTATION to YamlEncoder constructor options to configure additional indentation for each level of nesting. This allows configuring indentation in the service configuration.
- Add
SerializedPathannotation to flatten nested attributes
6.1
- Add
TraceableSerializer,TraceableNormalizer,TraceableEncoderandSerializerDataCollectorto integrate with the web profiler - Add the ability to create contexts using context builders
- Set
Contextannotation as not final - Deprecate
ContextAwareNormalizerInterface, useNormalizerInterfaceinstead - Deprecate
ContextAwareDenormalizerInterface, useDenormalizerInterfaceinstead - Deprecate supporting denormalization for
AbstractUidinUidNormalizer, use one ofAbstractUidchild class instead - Deprecate denormalizing to an abstract class in
UidNormalizer - Add support for
can*()methods toObjectNormalizer
6.0
- Remove
ArrayDenormalizer::setSerializer(), callsetDenormalizer()instead - Remove the ability to create instances of the annotation classes by passing an array of parameters, use named arguments instead
5.4
- Add support of PHP backed enumerations
- Add support for serializing empty array as object
- Return empty collections as
ArrayObjectfromSerializer::normalize()whenPRESERVE_EMPTY_OBJECTSis set - Add support for collecting type errors during denormalization
- Add missing arguments in
MissingConstructorArgumentsException
5.3
- Add the ability to provide (de)normalization context using metadata (e.g.
@Symfony\Component\Serializer\Annotation\Context) - Deprecate
ArrayDenormalizer::setSerializer(), callsetDenormalizer()instead - Add normalization formats to
UidNormalizer - Add
CsvEncoder::END_OF_LINEcontext option - Deprecate creating instances of the annotation classes by passing an array of parameters, use named arguments instead
5.2.0
- added
CompiledClassMetadataFactoryandClassMetadataFactoryCompilerfor faster metadata loading. - added
UidNormalizer - added
FormErrorNormalizer - added
MimeMessageNormalizer - serializer mapping can be configured using php attributes
5.1.0
- added support for scalar values denormalization
- added support for
\stdClasstoObjectNormalizer - added the ability to ignore properties using metadata (e.g.
@Symfony\Component\Serializer\Annotation\Ignore) - added an option to serialize constraint violations payloads (e.g. severity)
5.0.0
- throw an exception when creating a
Serializerwith normalizers which neither implementNormalizerInterfacenorDenormalizerInterface - throw an exception when creating a
Serializerwith encoders which neither implementEncoderInterfacenorDecoderInterface - changed the default value of the
CsvEncoder"as_collection" option totrue - removed
AbstractNormalizer::$circularReferenceLimit,AbstractNormalizer::$circularReferenceHandler,AbstractNormalizer::$callbacks,AbstractNormalizer::$ignoredAttributes,AbstractNormalizer::$camelizedAttributes,AbstractNormalizer::setCircularReferenceLimit(),AbstractNormalizer::setCircularReferenceHandler(),AbstractNormalizer::setCallbacks()andAbstractNormalizer::setIgnoredAttributes(), use the default context instead. - removed
AbstractObjectNormalizer::$maxDepthHandlerandAbstractObjectNormalizer::setMaxDepthHandler(), use the default context instead. - removed
XmlEncoder::setRootNodeName()&XmlEncoder::getRootNodeName(), use the default context instead. - removed individual encoders/normalizers options as constructor arguments.
- removed support for instantiating a
DataUriNormalizerwith a default MIME type guesser when thesymfony/mimecomponent isn't installed. - removed the
XmlEncoder::TYPE_CASE_ATTRIBUTESconstant. UseXmlEncoder::TYPE_CAST_ATTRIBUTESinstead.
4.4.0
- deprecated the
XmlEncoder::TYPE_CASE_ATTRIBUTESconstant, useXmlEncoder::TYPE_CAST_ATTRIBUTESinstead - added option to output a UTF-8 BOM in CSV encoder via
CsvEncoder::OUTPUT_UTF8_BOM_KEYcontext option - added
ProblemNormalizerto normalize errors according to the API Problem spec (RFC 7807)
4.3.0
- added the list of constraint violations' parameters in
ConstraintViolationListNormalizer - added support for serializing
DateTimeZoneobjects - added a
deep_object_to_populatecontext option to recursive denormalize onobject_to_populateobject.
4.2.0
- using the default context is the new recommended way to configure normalizers and encoders
- added a
skip_null_valuescontext option to not serialize properties with anullvalues AbstractNormalizer::handleCircularReferenceis now final and receives two optional extra arguments: the format and the context- added support for XML comment encoding (encoding
['#comment' => ' foo ']results<!-- foo -->) - added optional
int[] $encoderIgnoredNodeTypesargument toXmlEncoder::__constructto configure node types to be ignored during encoding - added
AdvancedNameConverterInterfaceto access the class, the format and the context in a name converter - the
AbstractNormalizer::handleCircularReference()method will have two new$formatand$contextarguments in version 5.0, not defining them is deprecated - deprecated creating a
Serializerwith normalizers which do not implement eitherNormalizerInterfaceorDenormalizerInterface - deprecated creating a
Serializerwith normalizers which do not implement eitherNormalizerInterfaceorDenormalizerInterface - deprecated creating a
Serializerwith encoders which do not implement eitherEncoderInterfaceorDecoderInterface - added the optional
$objectClassResolverargument inAbstractObjectNormalizerandObjectNormalizerconstructor - added
MetadataAwareNameConverterto configure the serialized name of properties through metadata YamlEncodernow handles the.ymlextension tooAbstractNormalizer::$circularReferenceLimit,AbstractNormalizer::$circularReferenceHandler,AbstractNormalizer::$callbacks,AbstractNormalizer::$ignoredAttributes,AbstractNormalizer::$camelizedAttributes,AbstractNormalizer::setCircularReferenceLimit(),AbstractNormalizer::setCircularReferenceHandler(),AbstractNormalizer::setCallbacks()andAbstractNormalizer::setIgnoredAttributes()are deprecated, use the default context instead.AbstractObjectNormalizer::$maxDepthHandlerandAbstractObjectNormalizer::setMaxDepthHandler()are deprecated, use the default context instead.- passing configuration options directly to the constructor of
CsvEncoder,JsonDecodeandXmlEncoderis deprecated since Symfony 4.2, use the default context instead.
4.1.0
- added
CacheableSupportsMethodInterfacefor normalizers and denormalizers that use only the type and the format in theirsupports*()methods - added
MissingConstructorArgumentsExceptionnew exception for deserialization failure of objects that needs data insertion in constructor - added an optional
default_constructor_argumentsoption of context to specify a default data in case the object is not initializable by its constructor because of data missing - added optional
bool $escapeFormulas = falseargument toCsvEncoder::__construct - added
AbstractObjectNormalizer::setMaxDepthHandlerto set a handler to call when the configured maximum depth is reached - added optional
int[] $ignoredNodeTypesargument toXmlEncoder::__construct. XML decoding now ignores comment node types by default. - added
ConstraintViolationListNormalizer
4.0.0
- removed the
SerializerAwareEncoderandSerializerAwareNormalizerclasses, use theSerializerAwareTraitinstead - removed the
Serializer::$normalizerCacheandSerializer::$denormalizerCacheproperties - added an optional
string $format = nullargument toAbstractNormalizer::instantiateObject - added an optional
array $context = []toSerializer::supportsNormalization,Serializer::supportsDenormalization,Serializer::supportsEncodingandSerializer::supportsDecoding
3.4.0
- added
AbstractObjectNormalizer::DISABLE_TYPE_ENFORCEMENTcontext option to disable throwing anUnexpectedValueExceptionon a type mismatch - added support for serializing
DateIntervalobjects - added getter for extra attributes in
ExtraAttributesException - improved
CsvEncoderto handle variable nested structures - CSV headers can be passed to the
CsvEncodervia thecsv_headersserialization context variable - added
$contextwhen checking for encoding, decoding and normalizing inSerializer
3.3.0
- added
SerializerPass
3.1.0
- added support for serializing objects that implement
JsonSerializable - added the
DenormalizerAwareTraitandNormalizerAwareTraittraits to support normalizer/denormalizer awareness - added the
DenormalizerAwareInterfaceandNormalizerAwareInterfaceinterfaces to support normalizer/denormalizer awareness - added a PSR-6 compatible adapter for caching metadata
- added a
MaxDepthoption to limit the depth of the object graph when serializing objects - added support for serializing
SplFileInfoobjects - added support for serializing objects that implement
DateTimeInterface - added
AbstractObjectNormalizeras a base class for normalizers that deal with objects - added support to relation deserialization
2.7.0
- added support for serialization and deserialization groups including annotations, XML and YAML mapping.
- added
AbstractNormalizerto factorise code and ease normalizers development - added circular references handling for
PropertyNormalizer - added support for a context key called
object_to_populateinAbstractNormalizerto reuse existing objects in the deserialization process - added
NameConverterInterfaceandCamelCaseToSnakeCaseNameConverter - [DEPRECATION]
GetSetMethodNormalizer::setCamelizedAttributes()andPropertyNormalizer::setCamelizedAttributes()are replaced byCamelCaseToSnakeCaseNameConverter - [DEPRECATION] the
Exceptioninterface has been renamed toExceptionInterface - added
ObjectNormalizerleveraging thePropertyAccesscomponent to normalize objects containing both properties and getters / setters / issers / hassers methods. - added
xml_type_cast_attributescontext option for allowing users to opt-out of typecasting xml attributes.
2.6.0
- added a new serializer:
PropertyNormalizer. LikeGetSetMethodNormalizer, this normalizer will map an object's properties to an array. - added circular references handling for
GetSetMethodNormalizer
2.5.0
- added support for
is.*getters inGetSetMethodNormalizer
2.4.0
- added
$contextsupport for XMLEncoder. - [DEPRECATION] JsonEncode and JsonDecode where modified to throw
an exception if error found. No need for
get*Error()functions
2.3.0
- added
GetSetMethodNormalizer::setCamelizedAttributesto allow calling camel cased methods for underscored properties
2.2.0
- [BC BREAK] All Serializer, Normalizer and Encoder interfaces have been
modified to include an optional
$contextarray parameter. - The XML Root name can now be configured with the
xml_root_nameparameter in the context option to theXmlEncoder. - Options to
json_encodeandjson_decodecan be passed through the context options ofJsonEncodeandJsonDecodeencoder/decoders.
2.1.0
-
added DecoderInterface::supportsDecoding(), EncoderInterface::supportsEncoding()
-
removed NormalizableInterface::denormalize(), NormalizerInterface::denormalize(), NormalizerInterface::supportsDenormalization()
-
removed normalize() denormalize() encode() decode() supportsSerialization() supportsDeserialization() supportsEncoding() supportsDecoding() getEncoder() from SerializerInterface
-
Serializer now implements NormalizerInterface, DenormalizerInterface, EncoderInterface, DecoderInterface in addition to SerializerInterface
-
added DenormalizableInterface and DenormalizerInterface
-
[BC BREAK] changed
GetSetMethodNormalizer's key names from all lowercased to camelCased (e.g.mypropertyvaluetomyPropertyValue) -
[BC BREAK] convert the
itemXML tag to an array<?xml version="1.0"?> <response> <item><title><![CDATA[title1]]></title></item><item><title><![CDATA[title2]]></title></item> </response>Before:
Array()After:
Array( [item] => Array( [0] => Array( [title] => title1 ) [1] => Array( [title] => title2 ) ) )