From fb8c922b7d397ce17e5e0aad69a9de0c73e53427 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Tue, 5 Dec 2017 16:13:25 +0100 Subject: [PATCH] --- README.rst | 3 +++ RequestValidator.php | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 README.rst create mode 100644 RequestValidator.php diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..1f80d24 --- /dev/null +++ b/README.rst @@ -0,0 +1,3 @@ +https://noctus.net/2011/extbase-model-zugriff-in-validatoren is outdated. + +Solution: use forProperty() \ No newline at end of file diff --git a/RequestValidator.php b/RequestValidator.php new file mode 100644 index 0000000..4bc4577 --- /dev/null +++ b/RequestValidator.php @@ -0,0 +1,23 @@ +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 + ) + ); + } + } +} +?> -- 2.30.2