Copied!

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')
CloneableInstantiable
Constants
public Symfony\Component\Serializer\Normalizer\DenormalizerInterface::COLLECT_DENORMALIZATION_ERRORS = 'collect_denormalization_errors'
public Symfony\Component\Serializer\Serializer::EMPTY_ARRAY_AS_OBJECT = 'empty_array_as_object'
 

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 = [])
 
  • param (\NormalizerInterface|DenormalizerInterface)[] $normalizers
  • param (\EncoderInterface|DecoderInterface)[] $encoders
public final decode(string $data, string $format, array $context = []) : ?mixed
 
    public denormalize(?mixed $data, string $type, ?string $format = NULL, array $context = []) : ?mixed
     
    • throws NotNormalizableValueException
    public final deserialize(?mixed $data, string $type, string $format, array $context = []) : ?mixed
     
      public final encode(?mixed $data, string $format, array $context = []) : string
       
        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
                   
                    Constants
                    private Symfony\Component\Serializer\Serializer::SCALAR_TYPES = ['int' => true, 'bool' => true, 'float' => true, 'string' => true]
                    Properties
                    private $denormalizerCache
                    private $normalizerCache
                    private $normalizers
                    Methods
                    private getDenormalizer(?mixed $data, string $class, ?string $format, array $context) : ?Symfony\Component\Serializer\Normalizer\DenormalizerInterface
                     

                    Returns a matching denormalizer.

                    • param mixed $data Data to restore
                    • param string $class The expected class to instantiate
                    • param string $format Format name, present to give the option to normalizers to act differently based on formats
                    • param array $context Options available to the denormalizer
                    private getNormalizer(?mixed $data, ?string $format, array $context) : ?Symfony\Component\Serializer\Normalizer\NormalizerInterface
                     

                    Returns a matching normalizer.

                    • param mixed $data Data to get the serializer for
                    • param string $format Format name, present to give the option to normalizers to act differently based on formats
                    • param array $context Options available to the normalizer
                    © 2022 Bruce Wells
                    Search Namespaces \ Classes
                    Configuration