Flow Validator Reference
This reference was automatically generated from code on 2024-10-23
AggregateBoundaryValidator
A validator which will not validate Aggregates that are lazy loaded and uninitialized. Validation over Aggregate Boundaries can hence be forced by making the relation to other Aggregate Roots eager loaded.
Note that this validator is not part of the public API and you should not use it manually.
Checks if the given value is valid according to the validator, and returns the Error Messages object which occurred. Will skip validation if value is an uninitialized lazy loading proxy.
Note
A value of NULL or an empty string (‘’) is considered valid
Arguments
skipUnInitializedProxies
(boolean, optional): Whether proxies not yet initialized should be skipped during validation
AlphanumericValidator
Validator for alphanumeric strings.
The given $value is valid if it is an alphanumeric string, which is defined as [[:alnum:]].
Note
A value of NULL or an empty string (‘’) is considered valid
BooleanValueValidator
Validator for a specific boolean value.
Checks if the given value is a specific boolean value.
Note
A value of NULL or an empty string (‘’) is considered valid
Arguments
expectedValue
(boolean, optional): The expected boolean value
CollectionValidator
A generic collection validator.
Checks for a collection and if needed validates the items in the collection. This is done with the specified element validator or a validator based on the given element type and validation group.
Either elementValidator or elementType must be given, otherwise validation will be skipped.
Note
A value of NULL or an empty string (‘’) is considered valid
Arguments
elementValidator
(string, optional): The validator type to use for the collection elementselementValidatorOptions
(array, optional): The validator options to use for the collection elementselementType
(string, optional): The type of the elements in the collectionvalidationGroups
(string, optional): The validation groups to link to
CountValidator
Validator for countable things
The given value is valid if it is an array or Countable that contains the specified amount of elements.
Note
A value of NULL or an empty string (‘’) is considered valid
Arguments
minimum
(integer, optional): The minimum count to acceptmaximum
(integer, optional): The maximum count to accept
DateTimeRangeValidator
Validator for checking Date and Time boundaries
Adds errors if the given DateTime does not match the set boundaries.
latestDate and earliestDate may be each <time>, <start>/<duration> or <duration>/<end>, where <duration> is an ISO 8601 duration and <start> or <end> or <time> may be ‘now’ or a PHP supported format. (1)
In general, you are able to provide a timestamp or a timestamp with additional calculation. Calculations are done as described in ISO 8601 (2), with an introducing “P”. P7MT2H30M for example mean a period of 7 months, 2 hours and 30 minutes (P introduces a period at all, while a following T introduces the time-section of a period. This is not at least in order not to confuse months and minutes, both represented as M). A period is separated from the timestamp with a forward slash “/”. If the period follows the timestamp, that period is added to the timestamp; if the period precedes the timestamp, it’s subtracted. The timestamp can be one of PHP’s supported date formats (1), so also “now” is supported.
Use cases:
If you offer something that has to be manufactured and you ask for a delivery date, you might assure that this date is at least two weeks in advance; this could be done with the expression “now/P2W”. If you have a library of ancient goods and want to track a production date that is at least 5 years ago, you can express it with “P5Y/now”.
Examples:
- If you want to test if a given date is at least five minutes ahead, use
earliestDate: now/PT5M
- If you want to test if a given date was at least 10 days ago, use
latestDate: P10D/now
- If you want to test if a given date is between two fix boundaries, just combine the latestDate and earliestDate-options:
earliestDate: 2007-03-01T13:00:00Z latestDate: 2007-03-30T13:00:00Z
Footnotes:
http://de.php.net/manual/en/datetime.formats.compound.php (1) http://en.wikipedia.org/wiki/ISO_8601#Durations (2) http://en.wikipedia.org/wiki/ISO_8601#Time_intervals (3)
Note
A value of NULL or an empty string (‘’) is considered valid
Arguments
latestDate
(string, optional): The latest date to acceptearliestDate
(string, optional): The earliest date to accept
DateTimeValidator
Validator for DateTime objects.
Checks if the given value is a valid DateTime object.
Note
A value of NULL or an empty string (‘’) is considered valid
Arguments
locale
(string|Locale, optional): The locale to use for date parsingstrictMode
(boolean, optional): Use strict mode for date parsingformatLength
(string, optional): The format length, see DatesReader::FORMAT_LENGTH_*formatType
(string, optional): The format type, see DatesReader::FORMAT_TYPE_*
EmailAddressValidator
Validator for email addresses
Checks if the given value is a valid email address.
Note
A value of NULL or an empty string (‘’) is considered valid
Arguments
strict
(bool, optional): Whether to fail validation on RFC warningscheckDns
(bool, optional): Whether to use DNS checks
FileExtensionValidator
The given $value is has one of the allowed file extensions Note: a value of NULL or empty string (‘’) are considered valid
The given $value is valid media type matches one of the allowedTypes and none of the disallowedTypes
Note: a value of NULL or empty string (‘’) is considered valid and was handled already
Note
A value of NULL or an empty string (‘’) is considered valid
Arguments
allowedExtensions
(array): Array of allowed file extensions
FileSizeValidator
Validator for file sizes Note: a value of NULL or empty string (‘’) are considered valid
The given $value is valid media type matches one of the allowedTypes and none of the disallowedTypes
Note: a value of NULL or empty string (‘’) is considered valid and was handled already
Note
A value of NULL or an empty string (‘’) is considered valid
Arguments
minimum
(integer): Minimum allowed filesize in bytesmaximum
(integer): Maximum allowed filesize in bytes
FloatValidator
Validator for floats.
The given value is valid if it is of type float or a string matching the regular expression [0-9.e+-]
Note
A value of NULL or an empty string (‘’) is considered valid
GenericObjectValidator
A generic object validator which allows for specifying property validators.
Checks if the given value is valid according to the property validators.
Note
A value of NULL or an empty string (‘’) is considered valid
Arguments
skipUnInitializedProxies
(boolean, optional): Whether proxies not yet initialized should be skipped during validation
IntegerValidator
Validator for integers.
Checks if the given value is a valid integer.
Note
A value of NULL or an empty string (‘’) is considered valid
LabelValidator
A validator for labels.
Labels usually allow all kinds of letters, numbers, punctuation marks and the space character. What you don’t want in labels though are tabs, new line characters or HTML tags. This validator is for such uses.
The given value is valid if it matches the regular expression specified in PATTERN_VALIDCHARACTERS.
Note
A value of NULL or an empty string (‘’) is considered valid
LocaleIdentifierValidator
A validator for locale identifiers.
This validator validates a string based on the expressions of the Flow I18n implementation.
Is valid if the given value is a valid “locale identifier”.
Note
A value of NULL or an empty string (‘’) is considered valid
MediaTypeValidator
The given $value is matches the defined media types Note: a value of NULL or empty string (‘’) are considered valid
The given $value is valid media type matches one of the allowedTypes and none of the disallowedTypes
Note: a value of NULL or empty string (‘’) is considered valid and was handled already
Note
A value of NULL or an empty string (‘’) is considered valid
Arguments
allowedTypes
(array): Array of allowed media rangesdisallowedTypes
(array): Array of disallowed media ranges
NotEmptyValidator
Validator for not empty values.
Checks if the given value is not empty (NULL, empty string, empty array or empty object that implements the Countable interface).
NumberRangeValidator
Validator for general numbers
The given value is valid if it is a number in the specified range.
Note
A value of NULL or an empty string (‘’) is considered valid
Arguments
minimum
(integer, optional): The minimum value to acceptmaximum
(integer, optional): The maximum value to accept
NumberValidator
Validator for general numbers.
Checks if the given value is a valid number.
Note
A value of NULL or an empty string (‘’) is considered valid
Arguments
locale
(string|Locale, optional): The locale to use for number parsingstrictMode
(boolean, optional): Use strict mode for number parsingformatLength
(string, optional): The format length, see NumbersReader::FORMAT_LENGTH_*formatType
(string, optional): The format type, see NumbersReader::FORMAT_TYPE_*
RawValidator
A validator which accepts any input.
This validator is always valid.
Note
A value of NULL or an empty string (‘’) is considered valid
RegularExpressionValidator
Validator based on regular expressions.
Checks if the given value matches the specified regular expression.
Note
A value of NULL or an empty string (‘’) is considered valid
Arguments
regularExpression
(string): The regular expression to use for validation, used as given
StringLengthValidator
Validator for string length.
Checks if the given value is a valid string (or can be cast to a string if an object is given) and its length is between minimum and maximum specified in the validation options.
Note
A value of NULL or an empty string (‘’) is considered valid
Arguments
minimum
(integer, optional): Minimum length for a valid stringmaximum
(integer, optional): Maximum length for a valid stringignoreHtml
(boolean, optional): If true, HTML tags will be stripped before counting the characters
StringValidator
Validator for strings.
Checks if the given value is a string.
Note
A value of NULL or an empty string (‘’) is considered valid
TextValidator
Validator for “plain” text.
Checks if the given value is a valid text (contains no XML tags).
Be aware that the value of this check entirely depends on the output context. The validated text is not expected to be secure in every circumstance, if you want to be sure of that, use a customized regular expression or filter on output.
See http://php.net/filter_var for details.
Note
A value of NULL or an empty string (‘’) is considered valid
UniqueEntityValidator
Validator for uniqueness of entities.
Checks if the given value is a unique entity depending on it’s identity properties or custom configured identity properties.
Note
A value of NULL or an empty string (‘’) is considered valid
Arguments
identityProperties
(array, optional): List of custom identity properties.
UuidValidator
Validator for Universally Unique Identifiers.
Checks if the given value is a syntactically valid UUID.
Note
A value of NULL or an empty string (‘’) is considered valid