W3cubDocs

/Symfony 4.1

ClassMetadata

class ClassMetadata implements ClassMetadataInterface

{@inheritdoc}

Properties

$name
AttributeMetadataInterface[] $attributesMetadata
ClassDiscriminatorMapping|null $classDiscriminatorMapping

Methods

__construct(string $class, ClassDiscriminatorMapping $classDiscriminatorMapping = null)

Constructs a metadata for the given class.

string getName()

Returns the name of the backing PHP class.

addAttributeMetadata(AttributeMetadataInterface $attributeMetadata)

Adds an {@link AttributeMetadataInterface}.

AttributeMetadataInterface[] getAttributesMetadata()

Gets the list of {@link AttributeMetadataInterface}.

merge(ClassMetadataInterface $classMetadata)

Merges a {@link ClassMetadataInterface} in the current one.

ReflectionClass getReflectionClass()

Returns a {@link \ReflectionClass} instance for this class.

ClassDiscriminatorMapping|null getClassDiscriminatorMapping()
setClassDiscriminatorMapping(ClassDiscriminatorMapping $mapping = null)
string[] __sleep()

Returns the names of the properties that should be serialized.

Details

__construct(string $class, ClassDiscriminatorMapping $classDiscriminatorMapping = null)

Constructs a metadata for the given class.

Parameters

string $class
ClassDiscriminatorMapping $classDiscriminatorMapping

string getName()

Returns the name of the backing PHP class.

Return Value

string The name of the backing class

addAttributeMetadata(AttributeMetadataInterface $attributeMetadata)

Adds an {@link AttributeMetadataInterface}.

Parameters

AttributeMetadataInterface $attributeMetadata

AttributeMetadataInterface[] getAttributesMetadata()

Gets the list of {@link AttributeMetadataInterface}.

Return Value

AttributeMetadataInterface[]

merge(ClassMetadataInterface $classMetadata)

Merges a {@link ClassMetadataInterface} in the current one.

Parameters

ClassMetadataInterface $classMetadata

ReflectionClass getReflectionClass()

Returns a {@link \ReflectionClass} instance for this class.

Return Value

ReflectionClass

ClassDiscriminatorMapping|null getClassDiscriminatorMapping()

Return Value

ClassDiscriminatorMapping|null

setClassDiscriminatorMapping(ClassDiscriminatorMapping $mapping = null)

Parameters

ClassDiscriminatorMapping $mapping

string[] __sleep()

Returns the names of the properties that should be serialized.

Return Value

string[]

© 2004–2017 Fabien Potencier
Licensed under the MIT License.
https://api.symfony.com/4.1/Symfony/Component/Serializer/Mapping/ClassMetadata.html