PHP Класс 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.
Автор: Bernhard Schussek ([email protected])
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$groups array

Открытые методы

Метод Описание
__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

Описание методов

__construct() публичный Метод

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() публичный Метод

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

addImplicitGroupName() публичный Метод

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

getDefaultOption() публичный Метод

Override this method to define a default option.
См. также: __construct()
public getDefaultOption ( ) : string
Результат string

getRequiredOptions() публичный Метод

Override this method if you want to define required options.
См. также: __construct()
public getRequiredOptions ( ) : array
Результат array

getTargets() публичный Метод

This method should return one or more of the constants Constraint::CLASS_CONSTRAINT and Constraint::PROPERTY_CONSTRAINT.
public getTargets ( ) : string | array
Результат string | array One or more constant values

validatedBy() публичный Метод

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
Результат string

Описание свойств

$groups публичное свойство

public array $groups
Результат array