Symfony\Component\Validator\Constraint
Contains the properties of a constraint definition.
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 <bschussek@gmail.com>
Synopsis
class Constraint
{
- // constants
- const DEFAULT_GROUP = 'Default';
- const CLASS_CONSTRAINT = 'class';
- const PROPERTY_CONSTRAINT = 'property';
- // members
- public array $groups;
- // methods
- public void __construct()
- public void __set()
- public void addImplicitGroupName()
- public string getDefaultOption()
- public array getRequiredOptions()
- public string validatedBy()
- public string|array getTargets()
Hierarchy
Extended by
- Symfony\Component\Validator\Constraints\Currency
- Symfony\Component\Validator\Constraints\Valid
- Symfony\Component\Validator\Constraints\Isbn
- Symfony\Component\Validator\Constraints\Regex
- Symfony\Component\Validator\Constraints\EqualTo
- Symfony\Component\Validator\Constraints\Date
- Symfony\Component\Validator\Constraints\DateTime
- Symfony\Component\Validator\Constraints\NotIdenticalTo
- Symfony\Component\Validator\Constraints\File
- Symfony\Component\Validator\Constraints\LessThanOrEqual
- Symfony\Component\Validator\Constraints\Range
- Symfony\Component\Validator\Constraints\Image
- Symfony\Component\Validator\Constraints\Choice
- Symfony\Component\Validator\Constraints\CardScheme
- Symfony\Component\Validator\Constraints\False
- Symfony\Component\Validator\Constraints\Callback
- Symfony\Component\Validator\Constraints\NotNull
- Symfony\Component\Validator\Constraints\Collection
- Symfony\Component\Validator\Constraints\Ip
- Symfony\Component\Validator\Constraints\Language
- Symfony\Component\Validator\Constraints\Locale
- Symfony\Component\Validator\Constraints\Existence
- Symfony\Component\Validator\Constraints\NotBlank
- Symfony\Component\Validator\Constraints\LessThan
- Symfony\Component\Validator\Constraints\Url
- Symfony\Component\Validator\Constraints\Blank
- Symfony\Component\Validator\Constraints\Length
- Symfony\Component\Validator\Constraints\Iban
- Symfony\Component\Validator\Constraints\Collection\Required
- Symfony\Component\Validator\Constraints\Collection\Optional
- Symfony\Component\Validator\Constraints\Issn
- Symfony\Component\Validator\Constraints\AbstractComparison
- Symfony\Component\Validator\Constraints\GreaterThanOrEqual
- Symfony\Component\Validator\Constraints\Country
- Symfony\Component\Validator\Constraints\Count
- Symfony\Component\Validator\Constraints\Email
- Symfony\Component\Validator\Constraints\Required
- Symfony\Component\Validator\Constraints\Type
- Symfony\Component\Validator\Constraints\NotEqualTo
- Symfony\Component\Validator\Constraints\Optional
- Symfony\Component\Validator\Constraints\Null
- Symfony\Component\Validator\Constraints\IdenticalTo
- Symfony\Component\Validator\Constraints\Time
- Symfony\Component\Validator\Constraints\Luhn
- Symfony\Component\Validator\Constraints\GreaterThan
- Symfony\Component\Validator\Constraints\True
- Symfony\Component\Validator\Constraints\All
- Symfony\Component\Form\Extension\Validator\Constraints\Form
- Symfony\Component\Security\Core\Validator\Constraints\UserPassword
- Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity
Constants
Name | Value |
---|---|
DEFAULT_GROUP | 'Default' |
CLASS_CONSTRAINT | 'class' |
PROPERTY_CONSTRAINT | 'property' |
Members
public
- $groups — array
Methods
public
- __construct() — Initializes the constraint with options.
- __set() — Unsupported operation.
- addImplicitGroupName() — Adds the given group if this constraint is in the Default group
- getDefaultOption() — Returns the name of the default option
- getRequiredOptions() — Returns the name of the required options
- getTargets() — Returns whether the constraint can be put onto classes, properties or both
- validatedBy() — Returns the name of the class that validates this constraint