Skip to content

Commit ea2666c

Browse files
authored
Merge pull request #346 from dotkernel/issue-345
Issue #345: Implemented route grouping
2 parents f181df1 + 1d450f7 commit ea2666c

32 files changed

+155
-83
lines changed

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
"dotkernel/dot-mail": "^5.1.0",
4141
"dotkernel/dot-navigation": "^3.4.2",
4242
"dotkernel/dot-rbac-guard": "^3.4.2",
43+
"dotkernel/dot-router": "^1.0.4",
4344
"dotkernel/dot-session": "^5.6.0",
4445
"dotkernel/dot-twigrenderer": "3.4.3",
4546
"friendsofphp/proxy-manager-lts": "^1.0.16",

config/config.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
Mezzio\Twig\ConfigProvider::class,
2929

3030
// Dotkernel packages
31+
Dot\Cache\ConfigProvider::class,
3132
Dot\Cli\ConfigProvider::class,
3233
Dot\DataFixtures\ConfigProvider::class,
3334
Dot\DependencyInjection\ConfigProvider::class,
@@ -40,9 +41,9 @@
4041
Dot\Navigation\ConfigProvider::class,
4142
Dot\Rbac\ConfigProvider::class,
4243
Dot\Rbac\Guard\ConfigProvider::class,
44+
Dot\Router\ConfigProvider::class,
4345
Dot\Session\ConfigProvider::class,
4446
Dot\Twig\ConfigProvider::class,
45-
Dot\Cache\ConfigProvider::class,
4647

4748
// Include cache configuration
4849
new ArrayProvider($cacheConfig),

src/Admin/src/Handler/Account/GetAccountEditFormHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function __construct(
3838

3939
public function handle(ServerRequestInterface $request): ResponseInterface
4040
{
41-
$this->accountForm->setAttribute('action', $this->router->generateUri('admin::edit-account'));
41+
$this->accountForm->setAttribute('action', $this->router->generateUri('admin::account-edit'));
4242
$this->changePasswordForm->setAttribute(
4343
'action',
4444
$this->router->generateUri('admin::account-change-password')
@@ -50,7 +50,7 @@ public function handle(ServerRequestInterface $request): ResponseInterface
5050
$this->accountForm->bind($admin);
5151

5252
return new HtmlResponse(
53-
$this->template->render('admin::account', [
53+
$this->template->render('admin::account-view', [
5454
'accountForm' => $this->accountForm->prepare(),
5555
'changePasswordForm' => $this->changePasswordForm->prepare(),
5656
])

src/Admin/src/Handler/Account/GetAccountLoginFormHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function handle(ServerRequestInterface $request): ResponseInterface
4949
}
5050

5151
return new HtmlResponse(
52-
$this->template->render('admin::login', [
52+
$this->template->render('admin::login-form', [
5353
'form' => $this->form->prepare(),
5454
])
5555
);

src/Admin/src/Handler/Account/PostAccountChangePasswordHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function __construct(
5353
public function handle(ServerRequestInterface $request): ResponseInterface
5454
{
5555
try {
56-
$this->accountForm->setAttribute('action', $this->router->generateUri('admin::edit-account'));
56+
$this->accountForm->setAttribute('action', $this->router->generateUri('admin::account-edit'));
5757
$this->changePasswordForm->setAttribute(
5858
'action',
5959
$this->router->generateUri('admin::account-change-password')
@@ -68,7 +68,7 @@ public function handle(ServerRequestInterface $request): ResponseInterface
6868
$this->changePasswordForm->setData($this->getPostParams($request));
6969
if (! $this->changePasswordForm->isValid()) {
7070
return new HtmlResponse(
71-
$this->template->render('admin::account', [
71+
$this->template->render('admin::account-view', [
7272
'accountForm' => $this->accountForm->prepare(),
7373
'changePasswordForm' => $this->changePasswordForm->prepare(),
7474
])

src/Admin/src/Handler/Account/PostAccountEditHandler.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ public function __construct(
5151

5252
public function handle(ServerRequestInterface $request): ResponseInterface
5353
{
54-
$this->accountForm->setAttribute('action', $this->router->generateUri('admin::edit-account'));
55-
54+
$this->accountForm->setAttribute('action', $this->router->generateUri('admin::account-edit'));
5655
$this->changePasswordForm->setAttribute(
5756
'action',
5857
$this->router->generateUri('admin::account-change-password')
@@ -64,7 +63,7 @@ public function handle(ServerRequestInterface $request): ResponseInterface
6463
$this->accountForm->setData($this->getPostParams($request));
6564
if (! $this->accountForm->isValid()) {
6665
return new HtmlResponse(
67-
$this->template->render('admin::account', [
66+
$this->template->render('admin::account-view', [
6867
'accountForm' => $this->accountForm->prepare(),
6968
'changePasswordForm' => $this->changePasswordForm->prepare(),
7069
])
@@ -89,6 +88,6 @@ public function handle(ServerRequestInterface $request): ResponseInterface
8988
$this->messenger->addError(Message::AN_ERROR_OCCURRED);
9089
}
9190

92-
return new RedirectResponse($this->router->generateUri('admin::edit-account'));
91+
return new RedirectResponse($this->router->generateUri('admin::account-edit'));
9392
}
9493
}

src/Admin/src/Handler/Admin/GetAdminCreateFormHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function handle(ServerRequestInterface $request): ResponseInterface
3232
$this->form->setAttribute('action', $this->router->generateUri('admin::admin-create'));
3333

3434
return new HtmlResponse(
35-
$this->template->render('admin::create-admin-form', [
35+
$this->template->render('admin::admin-create-form', [
3636
'form' => $this->form->prepare(),
3737
])
3838
);

src/Admin/src/Handler/Admin/GetAdminDeleteFormHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function handle(ServerRequestInterface $request): ResponseInterface
5353
);
5454

5555
return new HtmlResponse(
56-
$this->template->render('admin::delete-admin-form', [
56+
$this->template->render('admin::admin-delete-form', [
5757
'form' => $this->form->prepare(),
5858
'admin' => $admin,
5959
]),

src/Admin/src/Handler/Admin/GetAdminEditFormHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function handle(ServerRequestInterface $request): ResponseInterface
7070
$this->form->bind($adminFormData);
7171

7272
return new HtmlResponse(
73-
$this->template->render('admin::edit-admin-form', [
73+
$this->template->render('admin::admin-edit-form', [
7474
'form' => $this->form->prepare(),
7575
])
7676
);

src/Admin/src/Handler/Admin/GetAdminListHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function handle(ServerRequestInterface $request): ResponseInterface
6161
$this->form->setAttribute('action', $this->router->generateUri('admin::admin-create'));
6262

6363
return new HtmlResponse(
64-
$this->template->render('admin::list', [
64+
$this->template->render('admin::admin-list', [
6565
'params' => $params,
6666
'admins' => $result['rows'],
6767
'statuses' => AdminStatusEnum::cases(),

0 commit comments

Comments
 (0)