PHP Класс Symfony\Component\Serializer\Normalizer\AbstractNormalizer

Автор: Kévin Dunglas ([email protected])
Наследование: extends Symfony\Component\Serializer\Normalizer\SerializerAwareNormalizer, implements Symfony\Component\Serializer\Normalizer\NormalizerInterface, implements Symfony\Component\Serializer\Normalizer\DenormalizerInterface
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$callbacks array
$camelizedAttributes array
$circularReferenceHandler callable
$circularReferenceLimit integer
$classMetadataFactory Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface | null
$ignoredAttributes array
$nameConverter Symfony\Component\Serializer\NameConverter\NameConverterInterface | null

Открытые методы

Метод Описание
__construct ( Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface $classMetadataFactory = null, Symfony\Component\Serializer\NameConverter\NameConverterInterface $nameConverter = null ) Sets the {@link ClassMetadataFactoryInterface} to use.
setCallbacks ( array $callbacks ) : self Set normalization callbacks.
setCircularReferenceHandler ( callable $circularReferenceHandler ) : self Set circular reference handler.
setCircularReferenceLimit ( integer $circularReferenceLimit ) : self Set circular reference limit.
setIgnoredAttributes ( array $ignoredAttributes ) : self Set ignored attributes for normalization and denormalization.

Защищенные методы

Метод Описание
getAllowedAttributes ( string | object $classOrObject, array $context, boolean $attributesAsString = false ) : string[] | Symfony\Component\Serializer\Mapping\AttributeMetadataInterface[] | boolean Gets attributes to normalize using groups.
getConstructor ( array &$data, string $class, array &$context, ReflectionClass $reflectionClass, array | boolean $allowedAttributes ) : ReflectionMethod | null Returns the method to use to construct an object. This method must be either the object constructor or static.
handleCircularReference ( object $object ) : mixed Handles a circular reference.
instantiateObject ( array &$data, string $class, array &$context, ReflectionClass $reflectionClass, array | boolean $allowedAttributes ) : object Instantiates an object using constructor parameters when needed.
isAllowedAttribute ( object | string $classOrObject, string $attribute, string | null $format = null, array $context = [] ) : boolean Is this attribute allowed?
isCircularReference ( object $object, array &$context ) : boolean Detects if the configured circular reference limit is reached.
prepareForDenormalization ( object | array $data ) : array Normalizes the given data to an array. It's particularly useful during the denormalization process.

Описание методов

__construct() публичный Метод

Sets the {@link ClassMetadataFactoryInterface} to use.
public __construct ( Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface $classMetadataFactory = null, Symfony\Component\Serializer\NameConverter\NameConverterInterface $nameConverter = null )
$classMetadataFactory Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface
$nameConverter Symfony\Component\Serializer\NameConverter\NameConverterInterface

getAllowedAttributes() защищенный Метод

Gets attributes to normalize using groups.
protected getAllowedAttributes ( string | object $classOrObject, array $context, boolean $attributesAsString = false ) : string[] | Symfony\Component\Serializer\Mapping\AttributeMetadataInterface[] | boolean
$classOrObject string | object
$context array
$attributesAsString boolean If false, return an array of {@link AttributeMetadataInterface}
Результат string[] | Symfony\Component\Serializer\Mapping\AttributeMetadataInterface[] | boolean

getConstructor() защищенный Метод

Returns the method to use to construct an object. This method must be either the object constructor or static.
protected getConstructor ( array &$data, string $class, array &$context, ReflectionClass $reflectionClass, array | boolean $allowedAttributes ) : ReflectionMethod | null
$data array
$class string
$context array
$reflectionClass ReflectionClass
$allowedAttributes array | boolean
Результат ReflectionMethod | null

handleCircularReference() защищенный Метод

If a circular reference handler is set, it will be called. Otherwise, a {@class CircularReferenceException} will be thrown.
protected handleCircularReference ( object $object ) : mixed
$object object
Результат mixed

instantiateObject() защищенный Метод

This method also allows to denormalize data into an existing object if it is present in the context with the object_to_populate. This object is removed from the context before being returned to avoid side effects when recursively normalizing an object graph.
protected instantiateObject ( array &$data, string $class, array &$context, ReflectionClass $reflectionClass, array | boolean $allowedAttributes ) : object
$data array
$class string
$context array
$reflectionClass ReflectionClass
$allowedAttributes array | boolean
Результат object

isAllowedAttribute() защищенный Метод

Is this attribute allowed?
protected isAllowedAttribute ( object | string $classOrObject, string $attribute, string | null $format = null, array $context = [] ) : boolean
$classOrObject object | string
$attribute string
$format string | null
$context array
Результат boolean

isCircularReference() защищенный Метод

Detects if the configured circular reference limit is reached.
protected isCircularReference ( object $object, array &$context ) : boolean
$object object
$context array
Результат boolean

prepareForDenormalization() защищенный Метод

Normalizes the given data to an array. It's particularly useful during the denormalization process.
protected prepareForDenormalization ( object | array $data ) : array
$data object | array
Результат array

setCallbacks() публичный Метод

Set normalization callbacks.
public setCallbacks ( array $callbacks ) : self
$callbacks array help normalize the result
Результат self

setCircularReferenceHandler() публичный Метод

Set circular reference handler.
public setCircularReferenceHandler ( callable $circularReferenceHandler ) : self
$circularReferenceHandler callable
Результат self

setCircularReferenceLimit() публичный Метод

Set circular reference limit.
public setCircularReferenceLimit ( integer $circularReferenceLimit ) : self
$circularReferenceLimit integer limit of iterations for the same object
Результат self

setIgnoredAttributes() публичный Метод

Set ignored attributes for normalization and denormalization.
public setIgnoredAttributes ( array $ignoredAttributes ) : self
$ignoredAttributes array
Результат self

Описание свойств

$callbacks защищенное свойство

protected array $callbacks
Результат array

$camelizedAttributes защищенное свойство

protected array $camelizedAttributes
Результат array

$circularReferenceHandler защищенное свойство

protected callable $circularReferenceHandler
Результат callable

$circularReferenceLimit защищенное свойство

protected int $circularReferenceLimit
Результат integer

$classMetadataFactory защищенное свойство

protected ClassMetadataFactoryInterface,Symfony\Component\Serializer\Mapping\Factory|null $classMetadataFactory
Результат Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface | null

$ignoredAttributes защищенное свойство

protected array $ignoredAttributes
Результат array

$nameConverter защищенное свойство

protected NameConverterInterface,Symfony\Component\Serializer\NameConverter|null $nameConverter
Результат Symfony\Component\Serializer\NameConverter\NameConverterInterface | null