Skip to content

Commit

Permalink
Fixing validationresult
Browse files Browse the repository at this point in the history
  • Loading branch information
Will Morgan committed Jul 31, 2013
1 parent d84a370 commit 8570c0e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions code/RestfulServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -570,14 +570,22 @@ protected function postHandler($className, $id, $actionName) {
else {
$formatterClass = $className;
}
$responseFormatter = $this->getResponseDataFormatter($formatterClass);
if($result instanceof DataObject) {
$responseFormatter = $this->getResponseDataFormatter($formatterClass);
}
else {
$responseFormatter = $reqFormatter;
}

$this->getResponse()->addHeader('Content-Type', $responseFormatter->getOutputContentType());

// Handle validation errors
if($result instanceof ValidationResult) {
return $this->handleValidationError($result, $reqFormatter);
}
else if($result instanceof ArrayList) {


if($result instanceof ArrayList) {
return $reqFormatter->convertArrayList($result);
}
else if(is_array($result)) {
Expand Down

0 comments on commit 8570c0e

Please sign in to comment.