PHP Class Symfony\Component\Validator\Constraint

A constraint can be defined on a class, an option or a getter method. The Constraint class encapsulates all the configuration required for validating this class, option or getter result successfully. Constraint instances are immutable and serializable.
Author: Bernhard Schussek ([email protected])
Mostrar archivo Open project: pmjones/php-framework-benchmarks Class Usage Examples

Public Properties

Property Type Description
$groups array

Public Methods

Method Description
__construct ( mixed $options = null ) Initializes the constraint with options.
__set ( $option, $value ) Unsupported operation.
addImplicitGroupName ( string $group ) Adds the given group if this constraint is in the Default group
getDefaultOption ( ) : string Returns the name of the default option
getRequiredOptions ( ) : array Returns the name of the required options
getTargets ( ) : string | array Returns whether the constraint can be put onto classes, properties or both
validatedBy ( ) : string Returns the name of the class that validates this constraint

Method Details

__construct() public method

You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties. Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead. You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown.
public __construct ( mixed $options = null )
$options mixed The options (as associative array) or the value for the default option (any other type)

__set() public method

Unsupported operation.
public __set ( $option, $value )

addImplicitGroupName() public method

Adds the given group if this constraint is in the Default group
public addImplicitGroupName ( string $group )
$group string

getDefaultOption() public method

Override this method to define a default option.
See also: __construct()
public getDefaultOption ( ) : string
return string

getRequiredOptions() public method

Override this method if you want to define required options.
See also: __construct()
public getRequiredOptions ( ) : array
return array

getTargets() public method

This method should return one or more of the constants Constraint::CLASS_CONSTRAINT and Constraint::PROPERTY_CONSTRAINT.
public getTargets ( ) : string | array
return string | array One or more constant values

validatedBy() public method

By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour.
public validatedBy ( ) : string
return string

Property Details

$groups public_oe property

public array $groups
return array