https://noctus.net/2011/extbase-model-zugriff-in-validatoren is outdated.
Solution: use forProperty()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | <?php namespace Vnd\Extname\Domain; class RequestValidator extends \TYPO3\CMS\Extbase\Validation\Validator\AbstractValidator { public function isValid($req) { if ($req->foo == 5 && $req->bar == '') { //require $bar only when $foo is 5 $this->result->forProperty('bar')->addError( new \TYPO3\CMS\Extbase\Validation\Error( $this->translateErrorMessage( 'validator.notempty.empty', 'extbase' ), 1221560910 ) ); } } } ?> |