class ClassMetadata extends ElementMetadata implements MetadataInterface, ClassBasedInterface, PropertyMetadataContainerInterface
Represents all the configured constraints on a given class.
Properties
| string | $name | |
| string | $defaultGroup | |
| MemberMetadata[] | $members | |
| PropertyMetadata[] | $properties | |
| GetterMetadata[] | $getters | |
| array | $groupSequence | |
| Boolean | $groupSequenceProvider |
Methods
|
__construct(string $class)
Constructs a metadata for the given class |
||
|
accept(ValidationVisitorInterface $visitor, mixed $value, string|string[] $group, string $propertyPath, $propagatedGroup = null)
Implementation of the Visitor design pattern. |
||
| array |
__sleep()
Returns the names of the properties that should be serialized. |
|
| string |
getClassName()
Returns the name of the backing PHP class. |
|
| string |
getDefaultGroup()
Returns the name of the default group for this class |
|
| ElementMetadata |
addConstraint(Constraint $constraint)
Adds a constraint to this element. |
|
| ClassMetadata |
addPropertyConstraint(string $property, Constraint $constraint)
Adds a constraint to the given property. |
|
| ClassMetadata |
addGetterConstraint(string $property, Constraint $constraint)
Adds a constraint to the getter of the given property. |
|
|
mergeConstraints(ClassMetadata $source)
Merges the constraints of the given metadata into this object. |
||
| Boolean |
hasMemberMetadatas(string $property)
Returns true if metadatas of members is present for the given property. |
|
| MemberMetadata[] |
getMemberMetadatas(string $property)
Returns all metadatas of members describing the given property. |
|
| Boolean |
hasPropertyMetadata(string $property)
Check if there's any metadata attached to the given named property. |
|
| PropertyMetadataInterface[] |
getPropertyMetadata(string $property)
Returns all metadata instances for the given named property. |
|
| array |
getConstrainedProperties()
Returns all properties for which constraints are defined. |
|
| ClassMetadata |
setGroupSequence(array $groups)
Sets the default group sequence for this class. |
|
| Boolean |
hasGroupSequence()
Returns whether this class has an overridden default group sequence. |
|
| array |
getGroupSequence()
Returns the default group sequence for this class. |
|
| ReflectionClass |
getReflectionClass()
Returns a ReflectionClass instance for this class. |
|
|
setGroupSequenceProvider(Boolean $active)
Sets whether a group sequence provider should be used. |
||
| Boolean |
isGroupSequenceProvider()
Returns whether the class is a group sequence provider. |
Details
at line 75
public
__construct(string $class)
Constructs a metadata for the given class
at line 86
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
<tt>accept()</tt>-call to all property metadata instances.
at line 125
public array
__sleep()
Returns the names of the properties that should be serialized.
at line 143
public string
getClassName()
Returns the name of the backing PHP class.
at line 163
public string
getDefaultGroup()
Returns the name of the default group for this class
For each class, the group "Default" is an alias for the group
"<ClassName>", where <ClassName> is the non-namespaced name of the
class. All constraints implicitly or explicitly assigned to group
"Default" belong to both of these groups, unless the class defines
a group sequence.
If a class defines a group sequence, validating the class in "Default"
will validate the group sequence. The constraints assigned to "Default"
can still be validated by validating the class in "<ClassName>".
at line 171
public ElementMetadata
addConstraint(Constraint $constraint)
Adds a constraint to this element.
at line 193
public ClassMetadata
addPropertyConstraint(string $property, Constraint $constraint)
Adds a constraint to the given property.
at line 219
public ClassMetadata
addGetterConstraint(string $property, Constraint $constraint)
Adds a constraint to the getter of the given property.
The name of the getter is assumed to be the name of the property with an
uppercased first letter and either the prefix "get" or "is".
at line 239
public
mergeConstraints(ClassMetadata $source)
Merges the constraints of the given metadata into this object.
at line 287
public Boolean
hasMemberMetadatas(string $property)
Returns true if metadatas of members is present for the given property.
at line 299
public MemberMetadata[]
getMemberMetadatas(string $property)
Returns all metadatas of members describing the given property.
at line 307
public Boolean
hasPropertyMetadata(string $property)
Check if there's any metadata attached to the given named property.
at line 315
public PropertyMetadataInterface[]
getPropertyMetadata(string $property)
Returns all metadata instances for the given named property.
If your implementation does not support properties, simply throw an
exception in this method (for example a <tt>BadMethodCallException</tt>).
at line 325
public array
getConstrainedProperties()
Returns all properties for which constraints are defined.
at line 339
public ClassMetadata
setGroupSequence(array $groups)
Sets the default group sequence for this class.
at line 363
public Boolean
hasGroupSequence()
Returns whether this class has an overridden default group sequence.
at line 373
public array
getGroupSequence()
Returns the default group sequence for this class.
at line 383
public ReflectionClass
getReflectionClass()
Returns a ReflectionClass instance for this class.
at line 399
public
setGroupSequenceProvider(Boolean $active)
Sets whether a group sequence provider should be used.
at line 417
public Boolean
isGroupSequenceProvider()
Returns whether the class is a group sequence provider.