PHP Class Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer

Author: Kévin Dunglas ([email protected])
Inheritance: extends AbstractNormalizer
显示文件 Open project: symfony/symfony Class Usage Examples

Public Methods

Method Description
__construct ( Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface $classMetadataFactory = null, Symfony\Component\Serializer\NameConverter\NameConverterInterface $nameConverter = null, Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface $propertyTypeExtractor = null )
denormalize ( $data, $class, $format = null, array $context = [] )
normalize ( $object, $format = null, array $context = [] )
supportsDenormalization ( $data, $type, $format = null )
supportsNormalization ( $data, $format = null )

Protected Methods

Method Description
extractAttributes ( object $object, string | null $format = null, array $context = [] ) : string[] Extracts attributes to normalize from the class of the given object, format and context.
getAttributeValue ( object $object, string $attribute, string | null $format = null, array $context = [] ) : mixed Gets the attribute value.
getAttributes ( object $object, string | null $format = null, array $context ) : string[] Gets and caches attributes for the given object, format and context.
setAttributeValue ( object $object, string $attribute, mixed $value, string | null $format = null, array $context = [] ) Sets attribute value.

Private Methods

Method Description
getCacheKey ( string | null $format, array $context ) : boolean | string Gets the cache key to use.
isMaxDepthReached ( array $attributesMetadata, string $class, string $attribute, array &$context ) : boolean Is the max depth reached for the given attribute?
updateData ( array $data, string $attribute, mixed $attributeValue ) : array Sets an attribute and apply the name converter if necessary.
validateAndDenormalize ( string $currentClass, string $attribute, mixed $data, string | null $format, array $context ) : mixed Validates the submitted data and denormalizes it.

Method Details

__construct() public method

public __construct ( Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface $classMetadataFactory = null, Symfony\Component\Serializer\NameConverter\NameConverterInterface $nameConverter = null, Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface $propertyTypeExtractor = null )
$classMetadataFactory Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface
$nameConverter Symfony\Component\Serializer\NameConverter\NameConverterInterface
$propertyTypeExtractor Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface

denormalize() public method

public denormalize ( $data, $class, $format = null, array $context = [] )
$context array

extractAttributes() abstract protected method

Extracts attributes to normalize from the class of the given object, format and context.
abstract protected extractAttributes ( object $object, string | null $format = null, array $context = [] ) : string[]
$object object
$format string | null
$context array
return string[]

getAttributeValue() abstract protected method

Gets the attribute value.
abstract protected getAttributeValue ( object $object, string $attribute, string | null $format = null, array $context = [] ) : mixed
$object object
$attribute string
$format string | null
$context array
return mixed

getAttributes() protected method

Gets and caches attributes for the given object, format and context.
protected getAttributes ( object $object, string | null $format = null, array $context ) : string[]
$object object
$format string | null
$context array
return string[]

normalize() public method

public normalize ( $object, $format = null, array $context = [] )
$context array

setAttributeValue() abstract protected method

Sets attribute value.
abstract protected setAttributeValue ( object $object, string $attribute, mixed $value, string | null $format = null, array $context = [] )
$object object
$attribute string
$value mixed
$format string | null
$context array

supportsDenormalization() public method

public supportsDenormalization ( $data, $type, $format = null )

supportsNormalization() public method

public supportsNormalization ( $data, $format = null )