diff --git a/Classes/Controller/ActionController.php b/Classes/Controller/ActionController.php index ee5e028..9be730e 100644 --- a/Classes/Controller/ActionController.php +++ b/Classes/Controller/ActionController.php @@ -90,6 +90,11 @@ class ActionController extends BaseController */ protected $redirect = null; + /** + * is valid + */ + protected $isValid = true; + /** * errors */ @@ -366,6 +371,15 @@ class ActionController extends BaseController { $validator = new Validator(); $input = $this->arrayRemoveEmptyStrings($input); + //@todo make optional when usiing rest api + //array_walk_recursive( + // $input, + // function (&$value) { + // if (filter_var($value, FILTER_VALIDATE_INT)) { + // $value = (int)$value; + // } + // } + //); $input = $this->arrayToObject($input); $validationResult = $validator->dataValidation( $input, @@ -373,6 +387,7 @@ class ActionController extends BaseController -1 ); if (!$validationResult->isValid()) { + $this->isValid = false; $this->responseStatus = [400 => 'validationError']; foreach ($validationResult->getErrors() as $error){ $errorLabel = null; @@ -607,6 +622,7 @@ class ActionController extends BaseController return json_encode($result); } $result = array_merge($result, ['cid' => $this->contentObjectUid]); + $result = array_merge($result, ['isValid' => $this->isValid]); if (!empty($this->ajaxEnv)) { $result = array_merge( $result,