Serializer serializes and deserializes data.
objects are turned into arrays by normalizers. arrays are turned into various output formats by encoders.
$serializer->serialize($obj, 'xml')
$serializer->decode($data, 'xml')
$serializer->denormalize($data, 'Class', 'xml')
- author Jordi Boggiano
- author Johannes M.
Schmitt - author Lukas Kahwe Smith
- author Kévin Dunglas
CloneableInstantiable
- Implements
Constants |
public Symfony Flag to control whether an empty array should be transformed to an object (in JSON: {}) or to a list (in JSON: []). |
Methods |
public __construct(array $normalizers = [], array $encoders = [], array $defaultContext = [])
|
public final decode(string $data, string $format, array $context = []) : ?mixed |
public denormalize(?mixed $data, string $type, ?string $format = NULL, array $context = []) : ?mixed
|
public final deserialize(?mixed $data, string $type, string $format, array $context = []) : ?mixed |
public final encode(?mixed $data, string $format, array $context = []) : string |
public getSupportedTypes(?string $format) : array |
public normalize(?mixed $data, ?string $format = NULL, array $context = []) : ArrayObject|array|string|int|float|bool|?null |
public final serialize(?mixed $data, string $format, array $context = []) : string |
public supportsDecoding(string $format, array $context = []) : bool |
public supportsDenormalization(?mixed $data, string $type, ?string $format = NULL, array $context = []) : bool |
public supportsEncoding(string $format, array $context = []) : bool |
public supportsNormalization(?mixed $data, ?string $format = NULL, array $context = []) : bool |
Properties |
protected Symfony |
protected Symfony |
Constants |
private Symfony |
Properties |
private array $defaultContext |
private array $denormalizerCache = []
|
private array $normalizerCache = []
|
private array $normalizers |
Methods |
private getDenormalizer(?mixed $data, string $class, ?string $format, array $context) : ?Symfony Returns a matching denormalizer.
|
private getNormalizer(?mixed $data, ?string $format, array $context) : ?Symfony Returns a matching normalizer.
|