Normalizer implementation.
- author Kévin Dunglas
Constants |
public Symfony If ATTRIBUTES are specified, and the source has fields that are not part of that list, |
public Symfony Limit (de)normalize to the specified names. For nested structures, this list needs to reflect the object tree. |
public Symfony Hashmap of field name => callable to (de)normalize this field. The callable is called if the field is encountered with the arguments:
|
public Symfony Handler to call when a circular reference has been detected. If you specify no handler, a CircularReferenceException is thrown. The method will be called with ($object, $format, $context) and its |
public Symfony How many loops of circular reference to allow while normalizing. The default value of 1 means that when we encounter the same object a You can raise this value for special cases, e.g. in combination with the |
public Symfony Hashmap of default values for constructor arguments. The names need to match the parameter names in the constructor arguments. |
public Symfony Only (de)normalize attributes that are in the specified groups. |
public Symfony Skip the specified attributes when normalizing an object tree. This list is applied to each element of nested structures. Note: The behaviour for nested structures is different from ATTRIBUTES |
public Symfony Instead of creating a new instance of an object, update the specified object. If you have a nested structure, child objects will be overwritten with |
public Symfony Require all properties to be listed in the input instead of falling |
Methods |
public __construct(?Symfony Sets the {@link ClassMetadataFactoryInterface} to use. |
public hasCacheableSupportsMethod() : bool
|
public setSerializer(Symfony
|
Constants |
protected Symfony
|
Properties |
protected $classMetadataFactory = NULL
|
protected $defaultContext = ['allow_extra_attributes' => true, 'circular_reference_handler' => NULL, 'circular_reference_limit' => 1, 'ignored_attributes' => []] |
protected $nameConverter = NULL
|
protected $serializer = NULL
|
Methods |
protected final applyCallbacks(?mixed $value, object|string $object, string $attribute, ?string $format, array $context) : ?mixed |
protected createChildContext(array $parentContext, string $attribute, ?string $format) : array
|
protected denormalizeParameter(ReflectionClass $class, ReflectionParameter $parameter, string $parameterName, ?mixed $parameterData, array $context, ?string $format = NULL) : ?mixed
|
protected extractObjectToPopulate(string $class, array $context, ?string $key = NULL) : ?object Extract the
|
protected getAllowedAttributes(object|string $classOrObject, array $context, bool $attributesAsString = false) Gets attributes to normalize using groups.
|
protected getAttributeDenormalizationContext(string $class, string $attribute, array $context) : array Computes the denormalization context merged with current one. Metadata always wins over global context, as more specific.
|
protected getAttributeMetadata(object|string $objectOrClass, string $attribute) : ?Symfony
|
protected getAttributeNormalizationContext(object $object, string $attribute, array $context) : array Computes the normalization context merged with current one. Metadata always wins over global context, as more specific.
|
protected getConstructor(array $data, string $class, array $context, ReflectionClass $reflectionClass, array|bool $allowedAttributes) : ?ReflectionMethod Returns the method to use to construct an object. This method must be either |
protected getGroups(array $context) : array |
protected handleCircularReference(object $object, ?string $format = NULL, array $context = []) : ?mixed Handles a circular reference. If a circular reference handler is set, it will be called. Otherwise, a
|
protected instantiateObject(array $data, string $class, array $context, ReflectionClass $reflectionClass, array|bool $allowedAttributes, ?string $format = NULL) Instantiates an object using constructor parameters when needed. This method also allows to denormalize data into an existing object if
|
protected isAllowedAttribute(object|string $classOrObject, string $attribute, ?string $format = NULL, array $context = []) Is this attribute allowed?
|
protected isCircularReference(object $object, array $context) : bool Detects if the configured circular reference limit is reached.
|
protected prepareForDenormalization(?mixed $data) : array Normalizes the given data to an array. It's particularly useful during |
protected final validateCallbackContext(array $context, string $contextType = '') : void Validate callbacks set in context.
|