mirror of
https://github.com/grocy/grocy.git
synced 2025-08-15 10:14:39 +00:00
Upgrade Slim Framework to v4 (closes #561)
This commit is contained in:
@@ -5,7 +5,7 @@ namespace Grocy\Controllers;
|
||||
class BaseApiController extends BaseController
|
||||
{
|
||||
|
||||
public function __construct(\Slim\Container $container)
|
||||
public function __construct(\DI\Container $container)
|
||||
{
|
||||
parent::__construct($container);
|
||||
$this->OpenApiSpec = json_decode(file_get_contents(__DIR__ . '/../grocy.openapi.json'));
|
||||
@@ -13,17 +13,18 @@ class BaseApiController extends BaseController
|
||||
|
||||
protected $OpenApiSpec;
|
||||
|
||||
protected function ApiResponse($data)
|
||||
protected function ApiResponse(\Psr\Http\Message\ResponseInterface $response, $data)
|
||||
{
|
||||
return json_encode($data);
|
||||
$response->getBody()->write(json_encode($data));
|
||||
return $response;
|
||||
}
|
||||
|
||||
protected function EmptyApiResponse($response, $status = 204)
|
||||
protected function EmptyApiResponse(\Psr\Http\Message\ResponseInterface $response, $status = 204)
|
||||
{
|
||||
return $response->withStatus($status);
|
||||
}
|
||||
|
||||
protected function GenericErrorResponse($response, $errorMessage, $status = 400)
|
||||
protected function GenericErrorResponse(\Psr\Http\Message\ResponseInterface $response, $errorMessage, $status = 400)
|
||||
{
|
||||
return $response->withStatus($status)->withJson(array(
|
||||
'error_message' => $errorMessage
|
||||
|
Reference in New Issue
Block a user