Symfony2 API
Class

Symfony\Component\Validator\Mapping\PropertyMetadata

class PropertyMetadata extends MemberMetadata

Properties

Constraint[] $constraints
array $constraintsByGroup
$class
$name
$property
$cascaded
$collectionCascaded
$collectionCascadedDeeply

Methods

__construct(string $class, string $name)

Constructor.

accept(ValidationVisitorInterface $visitor, mixed $value, string|string[] $group, string $propertyPath, $propagatedGroup = null)

Implementation of the Visitor design pattern.

from MemberMetadata
ElementMetadata addConstraint(Constraint $constraint)

Adds a constraint to this element.

from MemberMetadata
array __sleep()

Returns the names of the properties that should be serialized

from MemberMetadata
string getName()

Returns the name of the member

from MemberMetadata
string getClassName()

Returns the class this member is defined on

from MemberMetadata
string getPropertyName()

Returns the name of the property this member belongs to

from MemberMetadata
Boolean isPublic(object|string $objectOrClassName)

Returns whether this member is public

from MemberMetadata
Boolean isProtected(object|string $objectOrClassName)

Returns whether this member is protected

from MemberMetadata
Boolean isPrivate(object|string $objectOrClassName)

Returns whether this member is private

from MemberMetadata
Boolean isCascaded()

Returns whether objects stored in this member should be validated

from MemberMetadata
Boolean isCollectionCascaded()

Returns whether arrays or traversable objects stored in this member should be traversed and validated in each entry

from MemberMetadata
Boolean isCollectionCascadedDeeply()

Returns whether arrays or traversable objects stored in this member should be traversed recursively for inner arrays/traversable objects

from MemberMetadata
object getReflectionMember(object|string $objectOrClassName)

Returns the Reflection instance of the member

from MemberMetadata
mixed getPropertyValue($object)

Extracts the value of the property from the given container.

Details

at line 26
public __construct(string $class, string $name)

Constructor.

Parameters

string $class The class this property is defined on
string $name The name of this property

Exceptions

ValidatorException

in MemberMetadata at line 45
public accept(ValidationVisitorInterface $visitor, mixed $value, string|string[] $group, string $propertyPath, $propagatedGroup = null)

Implementation of the Visitor design pattern.

Calls {@link ValidationVisitorInterface::visit} and then forwards the accept()-call to all property metadata instances.

Parameters

ValidationVisitorInterface $visitor The visitor implementing the validation logic.
mixed $value The value to validate.
string|string[] $group The validation group to validate in.
string $propertyPath The current property path in the validation graph.
$propagatedGroup

in MemberMetadata at line 57
public ElementMetadata addConstraint(Constraint $constraint)

Adds a constraint to this element.

Parameters

Constraint $constraint

Return Value

ElementMetadata

in MemberMetadata at line 83
public array __sleep()

Returns the names of the properties that should be serialized

Return Value

array

in MemberMetadata at line 98
public string getName()

Returns the name of the member

Return Value

string

in MemberMetadata at line 108
public string getClassName()

Returns the class this member is defined on

Return Value

string The name of the backing class.

in MemberMetadata at line 118
public string getPropertyName()

Returns the name of the property this member belongs to

Return Value

string The property name

in MemberMetadata at line 130
public Boolean isPublic(object|string $objectOrClassName)

Returns whether this member is public

Parameters

object|string $objectOrClassName The object or the class name

Return Value

Boolean

in MemberMetadata at line 142
public Boolean isProtected(object|string $objectOrClassName)

Returns whether this member is protected

Parameters

object|string $objectOrClassName The object or the class name

Return Value

Boolean

in MemberMetadata at line 154
public Boolean isPrivate(object|string $objectOrClassName)

Returns whether this member is private

Parameters

object|string $objectOrClassName The object or the class name

Return Value

Boolean

in MemberMetadata at line 164
public Boolean isCascaded()

Returns whether objects stored in this member should be validated

Return Value

Boolean

in MemberMetadata at line 175
public Boolean isCollectionCascaded()

Returns whether arrays or traversable objects stored in this member should be traversed and validated in each entry

Return Value

Boolean

in MemberMetadata at line 186
public Boolean isCollectionCascadedDeeply()

Returns whether arrays or traversable objects stored in this member should be traversed recursively for inner arrays/traversable objects

Return Value

Boolean

in MemberMetadata at line 198
public object getReflectionMember(object|string $objectOrClassName)

Returns the Reflection instance of the member

Parameters

object|string $objectOrClassName The object or the class name

Return Value

object

at line 38
public mixed getPropertyValue($object)

Extracts the value of the property from the given container.

Parameters

$object

Return Value

mixed The value of the property.