CompiledClassMetadataFactory
and ClassMetadataFactoryCompiler
for faster metadata loading.UidNormalizer
FormErrorNormalizer
MimeMessageNormalizer
\stdClass
to ObjectNormalizer
@Symfony\Component\Serializer\Annotation\Ignore
)Serializer
with normalizers which neither implement NormalizerInterface
nor DenormalizerInterface
Serializer
with encoders which neither implement EncoderInterface
nor DecoderInterface
CsvEncoder
"as_collection" option to true
AbstractNormalizer::$circularReferenceLimit
, AbstractNormalizer::$circularReferenceHandler
,
AbstractNormalizer::$callbacks
, AbstractNormalizer::$ignoredAttributes
,
AbstractNormalizer::$camelizedAttributes
, AbstractNormalizer::setCircularReferenceLimit()
,
AbstractNormalizer::setCircularReferenceHandler()
, AbstractNormalizer::setCallbacks()
and
AbstractNormalizer::setIgnoredAttributes()
, use the default context instead.AbstractObjectNormalizer::$maxDepthHandler
and AbstractObjectNormalizer::setMaxDepthHandler()
,
use the default context instead.XmlEncoder::setRootNodeName()
& XmlEncoder::getRootNodeName()
, use the default context instead.DataUriNormalizer
with a default MIME type guesser when the symfony/mime
component isn't installed.XmlEncoder::TYPE_CASE_ATTRIBUTES
constant. Use XmlEncoder::TYPE_CAST_ATTRIBUTES
instead.XmlEncoder::TYPE_CASE_ATTRIBUTES
constant, use XmlEncoder::TYPE_CAST_ATTRIBUTES
insteadCsvEncoder::OUTPUT_UTF8_BOM_KEY
context optionProblemNormalizer
to normalize errors according to the API Problem spec (RFC 7807)ConstraintViolationListNormalizer
DateTimeZone
objectsdeep_object_to_populate
context option to recursive denormalize on object_to_populate
object.skip_null_values
context option to not serialize properties with a null
valuesAbstractNormalizer::handleCircularReference
is now final and receives
two optional extra arguments: the format and the context['#comment' => ' foo ']
results <!-- foo -->
)int[] $encoderIgnoredNodeTypes
argument to XmlEncoder::__construct
to configure node types to be ignored during encodingAdvancedNameConverterInterface
to access the class,
the format and the context in a name converterAbstractNormalizer::handleCircularReference()
method will have two new $format
and $context
arguments in version 5.0, not defining them is deprecatedSerializer
with normalizers which do not implement
either NormalizerInterface
or DenormalizerInterface
Serializer
with normalizers which do not implement
either NormalizerInterface
or DenormalizerInterface
Serializer
with encoders which do not implement
either EncoderInterface
or DecoderInterface
$objectClassResolver
argument in AbstractObjectNormalizer
and ObjectNormalizer
constructorMetadataAwareNameConverter
to configure the serialized name of properties through metadataYamlEncoder
now handles the .yml
extension tooAbstractNormalizer::$circularReferenceLimit
, AbstractNormalizer::$circularReferenceHandler
,
AbstractNormalizer::$callbacks
, AbstractNormalizer::$ignoredAttributes
,
AbstractNormalizer::$camelizedAttributes
, AbstractNormalizer::setCircularReferenceLimit()
,
AbstractNormalizer::setCircularReferenceHandler()
, AbstractNormalizer::setCallbacks()
and
AbstractNormalizer::setIgnoredAttributes()
are deprecated, use the default context instead.AbstractObjectNormalizer::$maxDepthHandler
and AbstractObjectNormalizer::setMaxDepthHandler()
are deprecated, use the default context instead.CsvEncoder
, JsonDecode
and
XmlEncoder
is deprecated since Symfony 4.2, use the default context instead.CacheableSupportsMethodInterface
for normalizers and denormalizers that use
only the type and the format in their supports*()
methodsMissingConstructorArgumentsException
new exception for deserialization failure
of objects that needs data insertion in constructordefault_constructor_arguments
option of context to specify a default data in
case the object is not initializable by its constructor because of data missingbool $escapeFormulas = false
argument to CsvEncoder::__construct
AbstractObjectNormalizer::setMaxDepthHandler
to set a handler to call when the configured
maximum depth is reachedint[] $ignoredNodeTypes
argument to XmlEncoder::__construct
. XML decoding now
ignores comment node types by default.ConstraintViolationListNormalizer
SerializerAwareEncoder
and SerializerAwareNormalizer
classes,
use the SerializerAwareTrait
insteadSerializer::$normalizerCache
and Serializer::$denormalizerCache
propertiesstring $format = null
argument to AbstractNormalizer::instantiateObject
array $context = []
to Serializer::supportsNormalization
, Serializer::supportsDenormalization
,
Serializer::supportsEncoding
and Serializer::supportsDecoding
AbstractObjectNormalizer::DISABLE_TYPE_ENFORCEMENT
context option
to disable throwing an UnexpectedValueException
on a type mismatchDateInterval
objectsExtraAttributesException
CsvEncoder
to handle variable nested structuresCsvEncoder
via the csv_headers
serialization context variable$context
when checking for encoding, decoding and normalizing in Serializer
SerializerPass
JsonSerializable
DenormalizerAwareTrait
and NormalizerAwareTrait
traits to
support normalizer/denormalizer awarenessDenormalizerAwareInterface
and NormalizerAwareInterface
interfaces to support normalizer/denormalizer awarenessMaxDepth
option to limit the depth of the object graph when
serializing objectsSplFileInfo
objectsDateTimeInterface
AbstractObjectNormalizer
as a base class for normalizers that deal
with objectsAbstractNormalizer
to factorise code and ease normalizers developmentPropertyNormalizer
object_to_populate
in AbstractNormalizer
to reuse existing objects in the deserialization processNameConverterInterface
and CamelCaseToSnakeCaseNameConverter
GetSetMethodNormalizer::setCamelizedAttributes()
and
PropertyNormalizer::setCamelizedAttributes()
are replaced by
CamelCaseToSnakeCaseNameConverter
Exception
interface has been renamed to ExceptionInterface
ObjectNormalizer
leveraging the PropertyAccess
component to normalize
objects containing both properties and getters / setters / issers / hassers methods.xml_type_cast_attributes
context option for allowing users to opt-out of typecasting
xml attributes.PropertyNormalizer
. Like GetSetMethodNormalizer
,
this normalizer will map an object's properties to an array.GetSetMethodNormalizer
is.*
getters in GetSetMethodNormalizer
$context
support for XMLEncoder.get*Error()
functionsGetSetMethodNormalizer::setCamelizedAttributes
to allow calling
camel cased methods for underscored properties$context
array parameter.xml_root_name
parameter in the context option to the XmlEncoder
.json_encode
and json_decode
can be passed through
the context options of JsonEncode
and JsonDecode
encoder/decoders.GetSetMethodNormalizer
's key names from all lowercased
to camelCased (e.g. mypropertyvalue
to myPropertyValue
)[BC BREAK] convert the item
XML 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
)
)
)