Skip to content

Commit

Permalink
Merge pull request #9 from maurobonfietti/0.10.0
Browse files Browse the repository at this point in the history
Version 0.10.0
  • Loading branch information
maurobonfietti committed May 30, 2020
2 parents 2845733 + bea7079 commit f505f4d
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/Command/CrudGeneratorCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

class CrudGeneratorCommand extends Command
{
const COMMAND_VERSION = '0.9.0';
const COMMAND_VERSION = '0.10.0';

public function __construct($app)
{
Expand Down
5 changes: 2 additions & 3 deletions src/Command/TemplateBase/Objectbase/Create.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace App\Controller\Objectbase;

use App\Lib\JsonResponse;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;

Expand All @@ -14,8 +15,6 @@ public function __invoke(Request $request, Response $response): Response
$input = $request->getParsedBody();
$objectbase = $this->getObjectbaseService()->create($input);

$payload = json_encode($objectbase);
$response->getBody()->write($payload);
return $response->withHeader('Content-Type', 'application/json')->withStatus(201);
return JsonResponse::withJson($response, json_encode($objectbase), 201);
}
}
3 changes: 2 additions & 1 deletion src/Command/TemplateBase/Objectbase/Delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace App\Controller\Objectbase;

use App\Lib\JsonResponse;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;

Expand All @@ -13,6 +14,6 @@ public function __invoke(Request $request, Response $response, array $args): Res
{
$this->getObjectbaseService()->delete((int) $args['id']);

return $response->withHeader('Content-Type', 'application/json')->withStatus(204);
return JsonResponse::withJson($response, '', 204);
}
}
5 changes: 2 additions & 3 deletions src/Command/TemplateBase/Objectbase/GetAll.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace App\Controller\Objectbase;

use App\Lib\JsonResponse;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;

Expand All @@ -13,8 +14,6 @@ public function __invoke(Request $request, Response $response): Response
{
$objectbases = $this->getObjectbaseService()->getAll();

$payload = json_encode($objectbases);
$response->getBody()->write($payload);
return $response->withHeader('Content-Type', 'application/json')->withStatus(200);
return JsonResponse::withJson($response, json_encode($objectbases));
}
}
5 changes: 2 additions & 3 deletions src/Command/TemplateBase/Objectbase/GetOne.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace App\Controller\Objectbase;

use App\Lib\JsonResponse;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;

Expand All @@ -13,8 +14,6 @@ public function __invoke(Request $request, Response $response, array $args): Res
{
$objectbase = $this->getObjectbaseService()->getOne((int) $args['id']);

$payload = json_encode($objectbase);
$response->getBody()->write($payload);
return $response->withHeader('Content-Type', 'application/json')->withStatus(200);
return JsonResponse::withJson($response, json_encode($objectbase));
}
}
5 changes: 2 additions & 3 deletions src/Command/TemplateBase/Objectbase/Update.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace App\Controller\Objectbase;

use App\Lib\JsonResponse;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;

Expand All @@ -14,8 +15,6 @@ public function __invoke(Request $request, Response $response, array $args): Res
$input = $request->getParsedBody();
$objectbase = $this->getObjectbaseService()->update($input, (int) $args['id']);

$payload = json_encode($objectbase);
$response->getBody()->write($payload);
return $response->withHeader('Content-Type', 'application/json')->withStatus(200);
return JsonResponse::withJson($response, json_encode($objectbase));
}
}

0 comments on commit f505f4d

Please sign in to comment.