From 498402389c47b6a148c6b284c9b2917caee24f5c Mon Sep 17 00:00:00 2001 From: User for performing fabric deployments Date: Tue, 7 May 2019 14:08:32 +1200 Subject: [PATCH] FIX: Fixes #70 Added extension points for GET requests - MINOR: Fixed typos --- src/RestfulServer.php | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/RestfulServer.php b/src/RestfulServer.php index 69a60e0..48cbdf1 100644 --- a/src/RestfulServer.php +++ b/src/RestfulServer.php @@ -300,6 +300,8 @@ class RestfulServer extends Controller } } $responseFormatter->setTotalSize($objs->count()); + $this->extend('updateRestfulGetHandler', $objs, $responseFormatter); + return $responseFormatter->convertDataObjectSet($objs, $fields); } @@ -308,6 +310,8 @@ class RestfulServer extends Controller return $responseFormatter->convertDataObjectSet(new ArrayList(), $fields); } + $this->extend('updateRestfulGetHandler', $obj, $responseFormatter); + return $responseFormatter->convertDataObject($obj, $fields); } @@ -712,10 +716,10 @@ class RestfulServer extends Controller $this->getResponse()->addHeader('WWW-Authenticate', 'Basic realm="API Access"'); $this->getResponse()->addHeader('Content-Type', 'text/plain'); - $reponse = "You don't have access to this item through the API."; - $this->extend(__FUNCTION__, $reponse); + $response = "You don't have access to this item through the API."; + $this->extend(__FUNCTION__, $response); - return $reponse; + return $response; } /** @@ -727,10 +731,10 @@ class RestfulServer extends Controller $this->getResponse()->setStatusCode(404); $this->getResponse()->addHeader('Content-Type', 'text/plain'); - $reponse = "That object wasn't found"; - $this->extend(__FUNCTION__, $reponse); + $response = "That object wasn't found"; + $this->extend(__FUNCTION__, $response); - return $reponse; + return $response; } /** @@ -741,10 +745,10 @@ class RestfulServer extends Controller $this->getResponse()->setStatusCode(405); $this->getResponse()->addHeader('Content-Type', 'text/plain'); - $reponse = "Method Not Allowed"; - $this->extend(__FUNCTION__, $reponse); + $response = "Method Not Allowed"; + $this->extend(__FUNCTION__, $response); - return $reponse; + return $response; } /** @@ -755,10 +759,10 @@ class RestfulServer extends Controller $this->response->setStatusCode(415); // Unsupported Media Type $this->getResponse()->addHeader('Content-Type', 'text/plain'); - $reponse = "Unsupported Media Type"; - $this->extend(__FUNCTION__, $reponse); + $response = "Unsupported Media Type"; + $this->extend(__FUNCTION__, $response); - return $reponse; + return $response; } /**