I am about to write a validator in my TYPO3 CMS 7.6.x extension. I use the modern MVC struktur including Fluid (so not the old pi1 system). Here is my test validator (MyownValidator.php):
namespace My\Extension\Validation\Validator;
/**
* MyownValidator
*/
class MyownValidator extends \TYPO3\CMS\Extbase\Validation\Validator\AbstractValidator {
/**
* ...
*/
public function isValid($data){
if( $data != 'hello world' ){
$this->addError('ERRORMESSAGE', 1468329929);
return FALSE;
}
return TRUE;
}
}
And in the Model Class I add the validation line:
/**
* testattribute
*
* @var string
* @validate Myown
*/
protected $testattribute = '';
After clearing the complete cache in the install tool nothing happens. I still can create objects of this model with any value for testattribute.
And then I had a look in the TCA configuration and found that:
'eval' => 'trim,required'
Is there any way to use the validation of the models like TYPO3 Fluid does? Or do I have to write Validators like in TYPO3 CMS 4?