Skip to content

Commit 3938f68

Browse files
authored
Merge pull request #335 from dotkernel/issue-330
Replace controllers with handlers The foundation of version 6
2 parents 4d96642 + 400b20a commit 3938f68

98 files changed

Lines changed: 4353 additions & 1243 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2020 - 2024 DotKernel (https://www.dotkernel.com)
3+
Copyright (c) 2020 - 2024 Dotkernel (https://www.dotkernel.com)
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ Documentation is available at: https://docs.dotkernel.org/admin-documentation/
2727
[![Qodana](https://github.com/dotkernel/admin/actions/workflows/qodana_code_quality.yml/badge.svg?branch=5.0)](https://github.com/dotkernel/admin/actions/workflows/qodana_code_quality.yml)
2828
[![PHPStan](https://github.com/dotkernel/admin/actions/workflows/static-analysis.yml/badge.svg?branch=5.0)](https://github.com/dotkernel/admin/actions/workflows/static-analysis.yml)
2929

30-
## Installing DotKernel `admin`
30+
## Installing Dotkernel `admin`
3131

3232
## Tools
3333

34-
DotKernel can be installed through a single command that utilizes [Composer](https://getcomposer.org/). Because of that,
35-
Composer is required to install DotKernel `admin`.
34+
Dotkernel can be installed through a single command that utilizes [Composer](https://getcomposer.org/). Because of that,
35+
Composer is required to install Dotkernel `admin`.
3636

3737
### Composer
3838

@@ -44,19 +44,19 @@ Installation instructions:
4444
>If you have never used composer before make sure you read
4545
>the [`Composer Basic Usage`](https://getcomposer.org/doc/01-basic-usage.md) section in Composer's documentation
4646
47-
## Choosing an installation path for DotKernel `admin`
47+
## Choosing an installation path for Dotkernel `admin`
4848

4949
Example:
5050

5151
- absolute path `/var/www/dk-admin`
5252
- or relative path `dk-admin` (equivalent with `./dk-admin`)
5353

54-
## Installing DotKernel `admin`
54+
## Installing Dotkernel `admin`
5555

56-
After choosing the path for DotKernel (`dk-admin` will be used for the remainder of this example) it must be installed.
56+
After choosing the path for Dotkernel (`dk-admin` will be used for the remainder of this example) it must be installed.
5757
There are two installation methods.
5858

59-
### I. Installing DotKernel `admin` using composer
59+
### I. Installing Dotkernel `admin` using composer
6060

6161
>please use the below CLI commands in terminal, do NOT use the PhpStorm buttons
6262
@@ -73,7 +73,7 @@ The setup script prompts for some configuration settings, for example the lines
7373
[1] config/config.php
7474
Make your selection (default is 1):
7575

76-
Simply select `[0] Do not inject`, because DotKernel includes its own configProvider which already contains the prompted
76+
Simply select `[0] Do not inject`, because Dotkernel includes its own configProvider which already contains the prompted
7777
configurations.
7878

7979
If you choose `[1] config/config.php` Laminas's `ConfigProvider` from `session` will be injected.
@@ -84,7 +84,7 @@ The next question is:
8484

8585
Type `y` here, and hit `enter`
8686

87-
### II. Installing DotKernel `admin` using git clone
87+
### II. Installing Dotkernel `admin` using git clone
8888

8989
This method requires more manual input, but it ensures that the default branch is installed, even if it is not released.
9090
Run the following command:
@@ -95,7 +95,7 @@ The dependencies have to be installed separately, by running this command
9595

9696
composer install
9797

98-
Just like for `II Installing DotKernel admin using composer` (see above), the setup asks for configuration settings
98+
Just like for `II Installing Dotkernel admin using composer` (see above), the setup asks for configuration settings
9999
regarding injections (type `0` and hit `enter`) and a confirmation to use this setting for other packages (type `y` and
100100
hit `enter`)
101101

@@ -248,7 +248,7 @@ If you are still getting exceptions or errors regarding some missing services, t
248248
249249
- Open a web browser and visit `http://localhost:8080/`
250250

251-
You should see the `DotKernel admin` login page.
251+
You should see the `Dotkernel admin` login page.
252252

253253
If you ran the migrations you will have an admin user in the database with the following credentials:
254254

composer.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
],
1414
"authors": [
1515
{
16-
"name": "DotKernel Team",
16+
"name": "Dotkernel Team",
1717
"email": "team@dotkernel.com"
1818
}
1919
],
@@ -31,7 +31,6 @@
3131
"ext-gettext": "*",
3232
"dotkernel/dot-cache": "^4.0",
3333
"dotkernel/dot-cli": "^3.5.0",
34-
"dotkernel/dot-controller": "^3.4.3",
3534
"dotkernel/dot-data-fixtures": "^1.1.3",
3635
"dotkernel/dot-dependency-injection": "^1.0",
3736
"dotkernel/dot-errorhandler": "^4.0.0",
@@ -72,6 +71,8 @@
7271
"psr-4": {
7372
"Admin\\App\\": "src/App/src/",
7473
"Admin\\Admin\\": "src/Admin/src/",
74+
"Admin\\Page\\": "src/Page/src/",
75+
"Admin\\Dashboard\\": "src/Dashboard/src/",
7576
"Admin\\Setting\\": "src/Setting/src/"
7677
}
7778
},
@@ -92,7 +93,6 @@
9293
"development-disable": "laminas-development-mode disable",
9394
"development-enable": "laminas-development-mode enable",
9495
"development-status": "laminas-development-mode status",
95-
"mezzio": "mezzio --ansi",
9696
"check": [
9797
"@cs-check",
9898
"@test",
@@ -104,7 +104,6 @@
104104
"serve": "php -S 0.0.0.0:8080 -t public/",
105105
"static-analysis": "phpstan analyse --memory-limit 1G",
106106
"test": "phpunit --colors=always",
107-
"test-coverage": "phpunit --colors=always --coverage-clover clover.xml",
108107
"twig-cs-check": "vendor/bin/twig-cs-fixer lint --config=config/twig-cs-fixer.php",
109108
"twig-cs-fix": "vendor/bin/twig-cs-fixer lint --config=config/twig-cs-fixer.php --fix"
110109
}

config/autoload/local.php.dist

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ return [
3030
'name' => $app['name'] ?? '',
3131
'url' => $baseUrl,
3232
],
33+
'routes' => [
34+
'page' => [
35+
'component' => 'components',
36+
],
37+
],
3338
'databases' => $databases,
3439
'doctrine' => [
3540
'connection' => [

config/autoload/navigation.global.php

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@
1414
[
1515
'options' => [
1616
'label' => 'Dashboard',
17-
'uri' => '/',
1817
'route' => [
19-
'route_name' => 'dashboard',
18+
'route_name' => 'dashboard::dashboard-view',
2019
],
2120
'icon' => 'c-blue-500 ti-home',
2221
],
@@ -31,23 +30,26 @@
3130
[
3231
'options' => [
3332
'label' => 'Admins',
34-
'uri' => '/admin/list',
33+
'route' => [
34+
'route_name' => 'admin::admin-list',
35+
],
3536
],
3637
],
3738
[
3839
'options' => [
3940
'label' => 'Logins',
40-
'uri' => '/admin/logins',
41+
'route' => [
42+
'route_name' => 'admin::admin-login-list',
43+
],
4144
],
4245
],
4346
],
4447
],
4548
[
4649
'options' => [
4750
'label' => 'Components',
48-
'uri' => '/page/components',
4951
'route' => [
50-
'route_name' => 'page',
52+
'route_name' => 'page::components',
5153
],
5254
'icon' => 'c-pink-500 ti-palette',
5355
],
@@ -63,10 +65,7 @@
6365
'options' => [
6466
'label' => 'Profile',
6567
'route' => [
66-
'route_name' => 'admin',
67-
'route_params' => [
68-
'action' => 'account',
69-
],
68+
'route_name' => 'admin::account-edit-form',
7069
],
7170
'icon' => 'ti-user',
7271
],
@@ -75,10 +74,7 @@
7574
'options' => [
7675
'label' => 'Logout',
7776
'route' => [
78-
'route_name' => 'admin',
79-
'route_params' => [
80-
'action' => 'logout',
81-
],
77+
'route_name' => 'admin::admin-logout',
8278
],
8379
'icon' => 'ti-power-off',
8480
],

config/config.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@
5151
Admin\App\ConfigProvider::class,
5252
Admin\Admin\ConfigProvider::class,
5353
Admin\Setting\ConfigProvider::class,
54+
Admin\Page\ConfigProvider::class,
55+
Admin\Dashboard\ConfigProvider::class,
5456

5557
// Load application config in a pre-defined order in such a way that local settings
5658
// overwrite global settings. (Loaded as first to last):

data/doctrine/fixtures/AdminLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function load(ObjectManager $manager): void
2121
$admin = (new Admin())
2222
->setIdentity('admin')
2323
->setPassword(password_hash('dotadmin', PASSWORD_DEFAULT))
24-
->setFirstName('DotKernel')
24+
->setFirstName('Dotkernel')
2525
->setLastName('Admin')
2626
->addRole(
2727
$manager->getRepository(AdminRole::class)->findOneBy(['name' => AdminRole::ROLE_SUPERUSER])

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
},
1515
"keywords": [],
1616
"author": {
17-
"name": "DotKernel Team",
17+
"name": "Dotkernel Team",
1818
"email": "team@dotkernel.com"
1919
},
2020
"license": "ISC",

phpstan.neon

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ parameters:
2121
path: src
2222
-
2323
message: '#Call to an undefined method Laminas\\Authentication\\AuthenticationServiceInterface::getAdapter\(\)#'
24-
path: src/Admin/src/Controller/AdminController.php
24+
path: src/Admin/src/Handler/Account/PostAccountLoginHandler.php
2525
-
2626
message: '#Call to an undefined method Laminas\\Authentication\\AuthenticationServiceInterface::getStorage\(\)#'
27-
path: src/Admin/src/Controller/AdminController.php
27+
path: src/Admin/src/Handler/Account/PostAccountLoginHandler.php
2828

public/js/table_settings.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)