commit 0cf5f829c4b6801203698d5382f981941dd9ae46
parent 07e21bb6c8d3ff5cad5f7e7c001bd66a361ef6c9
Author: Jan Dankert <devnull@localhost>
Date: Tue, 7 Nov 2017 21:55:16 +0100
Setzen von Validierungsfehler über ein Result-Objekt - bisher ohne Funktion, mal schauen ob das sinnvoll ist.
Diffstat:
2 files changed, 41 insertions(+), 1 deletion(-)
diff --git a/action/Action.class.php b/action/Action.class.php
@@ -293,6 +293,11 @@ class Action
}
+ public function handleResult( $result )
+ {
+ // TODO -
+ }
+
/**
* F�gt ein Meldung hinzu.
*
@@ -758,4 +763,38 @@ class Action
}
}
+
+// TODO - nicht benutzt
+interface ActionResult
+{
+ public function getErrorField();
+ public function isSuccess();
+}
+
+class ActionResultSuccess implements ActionResult
+{
+ public function isSuccess(){
+ return true;
+ }
+ public function getErrorField(){
+ return null;
+ }
+}
+class ActionResultError implements ActionResult
+{
+ private $fieldName;
+
+ public function __construct( $name )
+ {
+ $this->fieldName = $name;
+ }
+ public function isSuccess(){
+ return false;
+ }
+ public function getErrorField(){
+ return $fieldName;
+ }
+}
+
+
?>
\ No newline at end of file
diff --git a/dispatcher.php b/dispatcher.php
@@ -215,7 +215,8 @@ try
Http::noContent();
// Jetzt wird die Aktion aus der Actionklasse aufgerufen.
- $do->$subactionMethodName();
+ $result = $do->$subactionMethodName();
+ $do->handleResult($result);
$do->forward();
}