mediatekformation

ClassMetadata extends GenericMetadata
in package
implements ClassMetadataInterface

Default implementation of {@link ClassMetadataInterface}.

This class supports serialization and cloning.

Tags
author

Bernhard Schussek bschussek@gmail.com

author

Fabien Potencier fabien@symfony.com

Interfaces, Classes, Traits and Enums

ClassMetadataInterface
Stores all metadata needed for validating objects of specific class.

Table of Contents

$reflClass  : ReflectionClass
__clone()  : mixed
Clones this object.
__construct()  : mixed
__sleep()  : array<string|int, string>
Returns the names of the properties that should be serialized.
addConstraint()  : $this
Adds a constraint.
addConstraints()  : $this
Adds an list of constraints.
addGetterConstraint()  : $this
Adds a constraint to the getter of the given property.
addGetterConstraints()  : $this
addGetterMethodConstraint()  : $this
Adds a constraint to the getter of the given property.
addGetterMethodConstraints()  : $this
addPropertyConstraint()  : $this
Adds a constraint to the given property.
addPropertyConstraints()  : $this
findConstraints()  : array<string|int, Constraint>
Returns all constraints for a given validation group.
getAutoMappingStrategy()  : int
getCascadingStrategy()  : int
Class nodes are never cascaded.
getClassName()  : string
Returns the name of the backing PHP class.
getConstrainedProperties()  : array<string|int, string>
Returns the names of all constrained properties.
getConstraints()  : array<string|int, Constraint>
Returns all constraints of this element.
getDefaultGroup()  : string
Returns the name of the default group for this class.
getGroupSequence()  : GroupSequence|null
Returns the group sequence that overrides the "Default" group for this class.
getPropertyMetadata()  : array<string|int, PropertyMetadataInterface>
Returns all metadata instances for the given named property.
getReflectionClass()  : ReflectionClass
Returns a ReflectionClass instance for this class.
getTraversalStrategy()  : int
Returns the strategy for traversing traversable objects.
hasConstraints()  : bool
Returns whether this element has any constraints.
hasGroupSequence()  : bool
Returns whether the "Default" group is overridden by a group sequence.
hasPropertyMetadata()  : bool
Check if there's any metadata attached to the given named property.
isGroupSequenceProvider()  : bool
Returns whether the "Default" group is overridden by a dynamic group sequence obtained by the validated objects.
mergeConstraints()  : mixed
Merges the constraints of the given metadata into this object.
setGroupSequence()  : $this
Sets the default group sequence for this class.
setGroupSequenceProvider()  : mixed
Sets whether a group sequence provider should be used.
addPropertyMetadata()  : mixed
checkConstraint()  : mixed
configureLengthConstraints()  : void

Properties

Methods

__clone()

Clones this object.

public __clone() : mixed
Return values
mixed

__construct()

public __construct(string $class) : mixed
Parameters
$class : string
Return values
mixed

__sleep()

Returns the names of the properties that should be serialized.

public __sleep() : array<string|int, string>
Return values
array<string|int, string>

addConstraints()

Adds an list of constraints.

public addConstraints(array<string|int, Constraint$constraints) : $this
Parameters
$constraints : array<string|int, Constraint>

The constraints to add

Return values
$this

addGetterConstraint()

Adds a constraint to the getter of the given property.

public addGetterConstraint(string $property, Constraint $constraint) : $this

The name of the getter is assumed to be the name of the property with an uppercased first letter and the prefix "get", "is" or "has".

Parameters
$property : string

The name of the property

$constraint : Constraint
Return values
$this

addGetterConstraints()

public addGetterConstraints(string $property, array<string|int, Constraint$constraints) : $this
Parameters
$property : string
$constraints : array<string|int, Constraint>
Return values
$this

addGetterMethodConstraint()

Adds a constraint to the getter of the given property.

public addGetterMethodConstraint(string $property, string $method, Constraint $constraint) : $this
Parameters
$property : string

The name of the property

$method : string

The name of the getter method

$constraint : Constraint
Return values
$this

addGetterMethodConstraints()

public addGetterMethodConstraints(string $property, string $method, array<string|int, Constraint$constraints) : $this
Parameters
$property : string
$method : string
$constraints : array<string|int, Constraint>
Return values
$this

addPropertyConstraint()

Adds a constraint to the given property.

public addPropertyConstraint(string $property, Constraint $constraint) : $this
Parameters
$property : string

The name of the property

$constraint : Constraint
Return values
$this

addPropertyConstraints()

public addPropertyConstraints(string $property, array<string|int, Constraint$constraints) : $this
Parameters
$property : string
$constraints : array<string|int, Constraint>
Return values
$this

findConstraints()

Returns all constraints for a given validation group.

public findConstraints(mixed $group) : array<string|int, Constraint>

Aware of the global group (* group).

Parameters
$group : mixed

The validation group

Return values
array<string|int, Constraint>

A list of constraint instances

getCascadingStrategy()

Class nodes are never cascaded.

public getCascadingStrategy() : int
Return values
int

The cascading strategy

getClassName()

Returns the name of the backing PHP class.

public getClassName() : string
Return values
string

The name of the backing class

getConstrainedProperties()

Returns the names of all constrained properties.

public getConstrainedProperties() : array<string|int, string>
Return values
array<string|int, string>

A list of property names

getConstraints()

Returns all constraints of this element.

public getConstraints() : array<string|int, Constraint>
Return values
array<string|int, Constraint>

A list of Constraint instances

getDefaultGroup()

Returns the name of the default group for this class.

public getDefaultGroup() : string

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>".

Return values
string

The name of the default group

getGroupSequence()

Returns the group sequence that overrides the "Default" group for this class.

public getGroupSequence() : GroupSequence|null
Return values
GroupSequence|null

The group sequence or null

getPropertyMetadata()

Returns all metadata instances for the given named property.

public getPropertyMetadata(mixed $property) : array<string|int, PropertyMetadataInterface>
Parameters
$property : mixed

The property name

Return values
array<string|int, PropertyMetadataInterface>

A list of metadata instances. Empty if no metadata exists for the property.

getReflectionClass()

Returns a ReflectionClass instance for this class.

public getReflectionClass() : ReflectionClass
Return values
ReflectionClass

getTraversalStrategy()

Returns the strategy for traversing traversable objects.

public getTraversalStrategy() : int
Return values
int

The traversal strategy

hasConstraints()

Returns whether this element has any constraints.

public hasConstraints() : bool
Return values
bool

hasGroupSequence()

Returns whether the "Default" group is overridden by a group sequence.

public hasGroupSequence() : bool
Return values
bool

Returns true if the "Default" group is overridden

hasPropertyMetadata()

Check if there's any metadata attached to the given named property.

public hasPropertyMetadata(mixed $property) : bool
Parameters
$property : mixed

The property name

Return values
bool

isGroupSequenceProvider()

Returns whether the "Default" group is overridden by a dynamic group sequence obtained by the validated objects.

public isGroupSequenceProvider() : bool
Return values
bool

Returns true if the "Default" group is overridden by a dynamic group sequence

mergeConstraints()

Merges the constraints of the given metadata into this object.

public mergeConstraints(self $source) : mixed
Parameters
$source : self
Return values
mixed

setGroupSequenceProvider()

Sets whether a group sequence provider should be used.

public setGroupSequenceProvider(bool $active) : mixed
Parameters
$active : bool
Tags
throws
GroupDefinitionException
Return values
mixed

configureLengthConstraints()

private configureLengthConstraints(array<string|int, mixed> $constraints) : void
Parameters
$constraints : array<string|int, mixed>
Return values
void

Search results