Upgrade Slim Framework to v4 (closes #561)

This commit is contained in:
Bernd Bestel
2020-02-11 17:42:03 +01:00
parent d56aebc9b8
commit d4fa1a64c2
34 changed files with 1169 additions and 561 deletions

View File

@@ -6,7 +6,7 @@ use \Grocy\Services\ChoresService;
class ChoresApiController extends BaseApiController
{
public function __construct(\Slim\Container $container)
public function __construct(\DI\Container $container)
{
parent::__construct($container);
$this->ChoresService = new ChoresService();
@@ -14,7 +14,7 @@ class ChoresApiController extends BaseApiController
protected $ChoresService;
public function TrackChoreExecution(\Slim\Http\Request $request, \Slim\Http\Response $response, array $args)
public function TrackChoreExecution(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
$requestBody = $request->getParsedBody();
@@ -33,7 +33,7 @@ class ChoresApiController extends BaseApiController
}
$choreExecutionId = $this->ChoresService->TrackChore($args['choreId'], $trackedTime, $doneBy);
return $this->ApiResponse($this->Database->chores_log($choreExecutionId));
return $this->ApiResponse($response, $this->Database->chores_log($choreExecutionId));
}
catch (\Exception $ex)
{
@@ -41,11 +41,11 @@ class ChoresApiController extends BaseApiController
}
}
public function ChoreDetails(\Slim\Http\Request $request, \Slim\Http\Response $response, array $args)
public function ChoreDetails(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
try
{
return $this->ApiResponse($this->ChoresService->GetChoreDetails($args['choreId']));
return $this->ApiResponse($response, $this->ChoresService->GetChoreDetails($args['choreId']));
}
catch (\Exception $ex)
{
@@ -53,16 +53,16 @@ class ChoresApiController extends BaseApiController
}
}
public function Current(\Slim\Http\Request $request, \Slim\Http\Response $response, array $args)
public function Current(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
return $this->ApiResponse($this->ChoresService->GetCurrent());
return $this->ApiResponse($response, $this->ChoresService->GetCurrent());
}
public function UndoChoreExecution(\Slim\Http\Request $request, \Slim\Http\Response $response, array $args)
public function UndoChoreExecution(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
try
{
$this->ApiResponse($this->ChoresService->UndoChoreExecution($args['executionId']));
$this->ApiResponse($response, $this->ChoresService->UndoChoreExecution($args['executionId']));
return $this->EmptyApiResponse($response);
}
catch (\Exception $ex)
@@ -71,7 +71,7 @@ class ChoresApiController extends BaseApiController
}
}
public function CalculateNextExecutionAssignments(\Slim\Http\Request $request, \Slim\Http\Response $response, array $args)
public function CalculateNextExecutionAssignments(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
try
{