Skip to content

Commit 8038038

Browse files
authored
Merge pull request #306 from dotkernel/issue-168
Issue #168: OpenAPI documentation
2 parents 31b99d6 + fda4bd2 commit 8038038

37 files changed

Lines changed: 2358 additions & 65 deletions

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@
7878
"mezzio/mezzio-twigrenderer": "^2.15.0",
7979
"ramsey/uuid-doctrine": "^2.1.0",
8080
"roave/psr-container-doctrine": "^5.2.1",
81-
"symfony/filesystem": "^7.0.3"
81+
"symfony/filesystem": "^7.0.3",
82+
"zircote/swagger-php": "^4.10"
8283
},
8384
"require-dev": {
8485
"laminas/laminas-coding-standard": "^2.5",

src/Admin/src/Entity/Admin.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public function __construct()
5454
{
5555
parent::__construct();
5656

57+
$this->created();
5758
$this->roles = new ArrayCollection();
5859
}
5960

src/Admin/src/Entity/AdminRole.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ class AdminRole extends AbstractEntity implements RoleInterface
2424
self::ROLE_SUPERUSER,
2525
];
2626

27+
public function __construct()
28+
{
29+
parent::__construct();
30+
31+
$this->created();
32+
}
33+
2734
#[ORM\Column(name: "name", type: "string", length: 30, unique: true)]
2835
protected string $name = '';
2936

src/Admin/src/Handler/AdminHandler.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ public function get(ServerRequestInterface $request): ResponseInterface
5858
return $this->createResponse($request, $admin);
5959
}
6060

61+
/**
62+
* @throws BadRequestException
63+
*/
6164
public function getCollection(ServerRequestInterface $request): ResponseInterface
6265
{
6366
return $this->createResponse($request, $this->adminService->getAdmins($request->getQueryParams()));

src/Admin/src/Handler/AdminRoleHandler.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Api\Admin\Handler;
66

77
use Api\Admin\Service\AdminRoleServiceInterface;
8+
use Api\App\Exception\BadRequestException;
89
use Api\App\Exception\NotFoundException;
910
use Api\App\Handler\HandlerTrait;
1011
use Dot\DependencyInjection\Attribute\Inject;
@@ -42,11 +43,11 @@ public function get(ServerRequestInterface $request): ResponseInterface
4243
return $this->createResponse($request, $role);
4344
}
4445

46+
/**
47+
* @throws BadRequestException
48+
*/
4549
public function getCollection(ServerRequestInterface $request): ResponseInterface
4650
{
47-
return $this->createResponse(
48-
$request,
49-
$this->roleService->getAdminRoles($request->getQueryParams())
50-
);
51+
return $this->createResponse($request, $this->roleService->getAdminRoles($request->getQueryParams()));
5152
}
5253
}

0 commit comments

Comments
 (0)