‪TYPO3CMS  11.5
TYPO3\CMS\Extbase\Validation\Validator\ValidatorInterface Interface Reference
Inheritance diagram for TYPO3\CMS\Extbase\Validation\Validator\ValidatorInterface:
TYPO3\CMS\Extbase\Tests\Unit\Reflection\Fixture\Validation\Validator\DummyValidator TYPO3\CMS\Extbase\Validation\Validator\AbstractValidator TYPO3\CMS\Extbase\Validation\Validator\ObjectValidatorInterface ExtbaseTeam\ActionControllerArgumentTest\Domain\Validation\Validator\FailingValidator ExtbaseTeam\BlogExample\Domain\Validator\PostValidator ExtbaseTeam\TestValidators\Validation\Validator\CustomNotInjectableValidator ExtbaseTeam\TestValidators\Validation\Validator\CustomValidator TYPO3\CMS\Extbase\Tests\Functional\Mvc\Controller\Fixture\Validation\Validator\CustomValidator TYPO3\CMS\Extbase\Tests\Unit\Validation\Fixtures\Validation\Validator\CustomValidator TYPO3\CMS\Extbase\Tests\Unit\Validation\Validator\Fixture\AbstractValidatorClass TYPO3\CMS\Extbase\Validation\Validator\AlphanumericValidator TYPO3\CMS\Extbase\Validation\Validator\BooleanValidator TYPO3\CMS\Extbase\Validation\Validator\DateTimeValidator TYPO3\CMS\Extbase\Validation\Validator\EmailAddressValidator TYPO3\CMS\Extbase\Validation\Validator\FloatValidator TYPO3\CMS\Extbase\Validation\Validator\GenericObjectValidator TYPO3\CMS\Extbase\Validation\Validator\IntegerValidator TYPO3\CMS\Extbase\Validation\Validator\NotEmptyValidator TYPO3\CMS\Extbase\Validation\Validator\NumberRangeValidator TYPO3\CMS\Extbase\Validation\Validator\NumberValidator TYPO3\CMS\Extbase\Validation\Validator\RegularExpressionValidator TYPO3\CMS\Extbase\Validation\Validator\StringLengthValidator TYPO3\CMS\Extbase\Validation\Validator\StringValidator TYPO3\CMS\Extbase\Validation\Validator\TextValidator TYPO3\CMS\Extbase\Validation\Validator\UrlValidator TYPO3\CMS\Form\Mvc\Validation\CountValidator TYPO3\CMS\Form\Mvc\Validation\DateRangeValidator TYPO3\CMS\Form\Mvc\Validation\EmptyValidator TYPO3\CMS\Form\Mvc\Validation\FileSizeValidator TYPO3\CMS\Form\Mvc\Validation\MimeTypeValidator TYPO3\CMS\Form\Tests\Unit\Mvc\Fixtures\AnotherTestValidator TYPO3\CMS\Form\Tests\Unit\Mvc\Validation\Fixtures\TestValidator TYPO3\CMS\Extbase\Validation\Validator\AbstractCompositeValidator TYPO3\CMS\Extbase\Validation\Validator\GenericObjectValidator

Public Member Functions

TYPO3 CMS Extbase Error Result validate ($value)
 
array getOptions ()
 

Detailed Description

Contract for a validator

Definition at line 21 of file ValidatorInterface.php.

Member Function Documentation

◆ getOptions()

array TYPO3\CMS\Extbase\Validation\Validator\ValidatorInterface::getOptions ( )

Receive validator options from framework.

Todo:
‪: Will be activated in v12 and implemented in AbstractValidator. Extensions may implement this for v10 & v11 compatible extensions if they need dependency injection in v11. If extending AbstractValidator in v11, a setOptions() implementation should call initializeDefaultOptions(), which will be done in AbstractValidator v12 automatically.

Returns the options of this validator which can be specified in the constructor

Returns
‪array
Todo:
‪: Return type 'array' will be added in v12. Extensions should add this for v11 & v12 compatible extensions if they override getOptions(). AbstractValidator will add 'Result' return in v12.

Implemented in TYPO3\CMS\Extbase\Validation\Validator\AbstractValidator, TYPO3\CMS\Extbase\Validation\Validator\AbstractCompositeValidator, and TYPO3\CMS\Extbase\Tests\Unit\Reflection\Fixture\Validation\Validator\DummyValidator.

◆ validate()

TYPO3 CMS Extbase Error Result TYPO3\CMS\Extbase\Validation\Validator\ValidatorInterface::validate (   $value)

Checks if the given value is valid according to the validator, and returns the Error Messages object which occurred.

Parameters
mixed$value‪The value that should be validated
Returns
‪\TYPO3\CMS\Extbase\Error\Result
Todo:

: Return type 'Result' will be added in v12. Extensions should add this for v11 & v12 compatible extensions if they override validate(). AbstractValidator will add 'Result' return in v12.

: Argument signature will be 'mixed $value' in v12, but AbstractValidator adds this starting with v13 only to simplify compat for extensions supporting v11 & v12 and thus PHP < 8.1.

Implemented in TYPO3\CMS\Extbase\Validation\Validator\AbstractValidator, TYPO3\CMS\Extbase\Validation\Validator\CollectionValidator, TYPO3\CMS\Extbase\Tests\Unit\Validation\Validator\Fixture\AbstractCompositeValidatorClass, TYPO3\CMS\Extbase\Validation\Validator\GenericObjectValidator, TYPO3\CMS\Extbase\Validation\Validator\DisjunctionValidator, TYPO3\CMS\Extbase\Validation\Validator\ConjunctionValidator, and TYPO3\CMS\Extbase\Tests\Unit\Reflection\Fixture\Validation\Validator\DummyValidator.

Referenced by TYPO3\CMS\Extbase\Tests\Unit\Validation\Validator\CollectionValidatorTest\collectionValidatorIsValidEarlyReturnsOnUninitializedLazyObjectStorages().