Symfony API
Class

Symfony\Component\Validator\Mapping\MemberMetadata

abstract class MemberMetadata extends GenericMetadata implements PropertyMetadataInterface

Stores all metadata needed for validating a class property.

The method of accessing the property's value must be specified by subclasses by implementing the {@link newReflectionMember()} method.

This class supports serialization and cloning.

Properties

Constraint[] $constraints
array $constraintsByGroup
int $cascadingStrategy The strategy for cascading objects.
int $traversalStrategy The strategy for traversing traversable objects.
string $class
string $name
string $property

Methods

string[] __sleep()

Returns the names of the properties that should be serialized.

__clone()

Clones this object.

from GenericMetadata
GenericMetadata addConstraint(Constraint $constraint)

Adds a constraint.

GenericMetadata addConstraints(array $constraints)

Adds an list of constraints.

from GenericMetadata
Constraint[] getConstraints()

Returns all constraints of this element.

from GenericMetadata
bool hasConstraints()

Returns whether this element has any constraints.

from GenericMetadata
Constraint[] findConstraints(string $group)

Returns all constraints for a given validation group.

from GenericMetadata
int getCascadingStrategy()

Returns the strategy for cascading objects.

from GenericMetadata
int getTraversalStrategy()

Returns the strategy for traversing traversable objects.

from GenericMetadata
__construct(string $class, string $name, string $property)

Constructor.

string getName()

Returns the name of the member.

getClassName()

{@inheritdoc}

string getPropertyName()

Returns the name of the property.

bool isPublic(object|string $objectOrClassName)

Returns whether this member is public.

bool isProtected(object|string $objectOrClassName)

Returns whether this member is protected.

bool isPrivate(object|string $objectOrClassName)

Returns whether this member is private.

ReflectionMethod|ReflectionProperty getReflectionMember(object|string $objectOrClassName)

Returns the reflection instance for accessing the member's value.

Details

at line 97
public string[] __sleep()

Returns the names of the properties that should be serialized.

Return Value

string[]

in GenericMetadata at line 96
public __clone()

Clones this object.

at line 80
public GenericMetadata addConstraint(Constraint $constraint)

Adds a constraint.

If the constraint {@link Valid} is added, the cascading strategy will be changed to {@link CascadingStrategy::CASCADE}. Depending on the $traverse property of that constraint, the traversal strategy will be set to one of the following:

Parameters

Constraint $constraint The constraint to add

Return Value

GenericMetadata This object

Exceptions

ConstraintDefinitionException When trying to add the {@link Traverse} constraint

in GenericMetadata at line 164
public GenericMetadata addConstraints(array $constraints)

Adds an list of constraints.

Parameters

array $constraints The constraints to add

Return Value

GenericMetadata This object

in GenericMetadata at line 176
public Constraint[] getConstraints()

Returns all constraints of this element.

Return Value

Constraint[] A list of Constraint instances

in GenericMetadata at line 186
public bool hasConstraints()

Returns whether this element has any constraints.

Return Value

bool

in GenericMetadata at line 196
public Constraint[] findConstraints(string $group)

Returns all constraints for a given validation group.

Parameters

string $group The validation group

Return Value

Constraint[] A list of constraint instances

in GenericMetadata at line 206
public int getCascadingStrategy()

Returns the strategy for cascading objects.

Return Value

int The cascading strategy

in GenericMetadata at line 214
public int getTraversalStrategy()

Returns the strategy for traversing traversable objects.

Return Value

int The traversal strategy

at line 70
public __construct(string $class, string $name, string $property)

Constructor.

Parameters

string $class The name of the class this member is defined on
string $name The name of the member
string $property The property the member belongs to

at line 111
public string getName()

Returns the name of the member.

Return Value

string

at line 119
public getClassName()

{@inheritdoc}

at line 127
public string getPropertyName()

Returns the name of the property.

Return Value

string The property name.

at line 139
public bool isPublic(object|string $objectOrClassName)

Returns whether this member is public.

Parameters

object|string $objectOrClassName The object or the class name

Return Value

bool

at line 151
public bool isProtected(object|string $objectOrClassName)

Returns whether this member is protected.

Parameters

object|string $objectOrClassName The object or the class name

Return Value

bool

at line 163
public bool isPrivate(object|string $objectOrClassName)

Returns whether this member is private.

Parameters

object|string $objectOrClassName The object or the class name

Return Value

bool

at line 175
public ReflectionMethod|ReflectionProperty getReflectionMember(object|string $objectOrClassName)

Returns the reflection instance for accessing the member's value.

Parameters

object|string $objectOrClassName The object or the class name

Return Value

ReflectionMethod|ReflectionProperty The reflection instance