Skip to content

Replace controllers with handlers - #335

Merged
arhimede merged 18 commits into
6.0from
issue-330
Mar 6, 2025
Merged

Replace controllers with handlers#335
arhimede merged 18 commits into
6.0from
issue-330

Conversation

@marioradu05

Copy link
Copy Markdown
Member

No description provided.

Signed-off-by: MarioRadu <magda_marior@yahoo.com>
@github-actions

github-actionsBot commented Feb 19, 2025

Copy link
Copy Markdown

Qodana for PHP

It seems all right 👌

No new problems were found according to the checks applied

💡 Qodana analysis was run in the pull request mode: only the changed files were checked
☁️ View the detailed Qodana report

Detected 114 dependencies

Third-party software list

This page lists the third-party software dependencies used in project

DependencyVersionLicenses
brick/math0.12.3MIT
brick/varexporter0.6.0MIT
composer/ca-bundle1.5.5MIT
doctrine/collections2.2.2MIT
doctrine/common3.5.0MIT
doctrine/data-fixtures2.0.2MIT
doctrine/dbal4.2.2MIT
doctrine/deprecations1.1.4MIT
doctrine/event-manager2.0.1MIT
doctrine/inflector2.0.10MIT
doctrine/instantiator2.0.0MIT
doctrine/lexer3.0.1MIT
doctrine/migrations3.8.2MIT
doctrine/orm3.3.2MIT
doctrine/persistence4.0.0MIT
dotkernel/dot-authentication2.6.0MIT
dotkernel/dot-authorization3.7.0MIT
dotkernel/dot-cache4.3.0MIT
dotkernel/dot-cli3.9.0MIT
dotkernel/dot-controller3.5.1MIT
dotkernel/dot-data-fixtures1.4.0MIT
dotkernel/dot-dependency-injection1.2.0MIT
dotkernel/dot-errorhandler4.0.0MIT
dotkernel/dot-event3.4.2MIT
dotkernel/dot-flashmessenger3.5.0MIT
dotkernel/dot-geoip3.9.0MIT
dotkernel/dot-helpers3.7.1MIT
dotkernel/dot-log4.0.4MIT
dotkernel/dot-mail5.1.5MIT
dotkernel/dot-navigation3.5.1MIT
dotkernel/dot-rbac-guard3.5.0MIT
dotkernel/dot-rbac3.6.0MIT
dotkernel/dot-session5.6.0MIT
dotkernel/dot-twigrenderer3.4.3MIT
egulias/email-validator4.0.3MIT
fig/http-message-util1.1.5MIT
friendsofphp/proxy-manager-ltsv1.0.18MIT
geoip2/geoip2v3.1.0Apache-2.0
guzzlehttp/guzzle7.9.2MIT
guzzlehttp/promises2.0.4MIT
guzzlehttp/psr72.7.0MIT
laminas/laminas-authentication2.16.0BSD-3-Clause
laminas/laminas-cli1.11.0BSD-3-Clause
laminas/laminas-code4.16.0BSD-3-Clause
laminas/laminas-component-installer3.5.0BSD-3-Clause
laminas/laminas-config-aggregator1.18.0BSD-3-Clause
laminas/laminas-diactoros3.5.0BSD-3-Clause
laminas/laminas-escaper2.16.0BSD-3-Clause
laminas/laminas-eventmanager3.14.0BSD-3-Clause
laminas/laminas-filter2.40.0BSD-3-Clause
laminas/laminas-form3.21.0BSD-3-Clause
laminas/laminas-httphandlerrunner2.11.0BSD-3-Clause
laminas/laminas-hydrator4.16.0BSD-3-Clause
laminas/laminas-i18n2.29.0BSD-3-Clause
laminas/laminas-inputfilter2.31.0BSD-3-Clause
laminas/laminas-json3.7.1BSD-3-Clause
laminas/laminas-math3.8.1BSD-3-Clause
laminas/laminas-permissions-rbac3.7.0BSD-3-Clause
laminas/laminas-servicemanager3.23.0BSD-3-Clause
laminas/laminas-session2.24.0BSD-3-Clause
laminas/laminas-stdlib3.20.0BSD-3-Clause
laminas/laminas-stratigility3.13.0BSD-3-Clause
laminas/laminas-translator1.1.0BSD-3-Clause
laminas/laminas-validator2.64.2BSD-3-Clause
laminas/laminas-view2.36.0BSD-3-Clause
maxmind-db/readerv1.12.0Apache-2.0
maxmind/web-service-commonv0.10.0Apache-2.0
mezzio/mezzio-authentication1.10.0BSD-3-Clause
mezzio/mezzio-authorization-rbac1.8.0BSD-3-Clause
mezzio/mezzio-authorization1.10.0BSD-3-Clause
mezzio/mezzio-cors1.13.0BSD-3-Clause
mezzio/mezzio-fastroute3.12.0BSD-3-Clause
mezzio/mezzio-helpers5.17.0BSD-3-Clause
mezzio/mezzio-router3.18.0BSD-3-Clause
mezzio/mezzio-template2.11.0BSD-3-Clause
mezzio/mezzio-twigrenderer2.17.0BSD-3-Clause
mezzio/mezzio3.20.1BSD-3-Clause
nikic/fast-routev1.3.0BSD-3-Clause
nikic/php-parserv5.4.0BSD-3-Clause
psr/cache3.0.0MIT
psr/container1.1.2MIT
psr/event-dispatcher1.0.0MIT
psr/http-client1.0.3MIT
psr/http-factory1.1.0MIT
psr/http-message2.0MIT
psr/http-server-handler1.0.2MIT
psr/http-server-middleware1.0.2MIT
psr/log3.0.2MIT
ralouphie/getallheaders3.0.3MIT
ramsey/collection2.1.0MIT
ramsey/uuid-doctrine2.1.0MIT
ramsey/uuid4.7.6MIT
roave/psr-container-doctrine5.7.0BSD-2-Clause
symfony/cache-contractsv3.5.1MIT
symfony/cachev7.2.4MIT
symfony/consolev7.2.1MIT
symfony/deprecation-contractsv3.5.1MIT
symfony/event-dispatcher-contractsv3.5.1MIT
symfony/event-dispatcherv7.2.0MIT
symfony/filesystemv7.2.0MIT
symfony/mailerv7.2.3MIT
symfony/mimev7.2.4MIT
symfony/polyfill-ctypev1.31.0MIT
symfony/polyfill-intl-graphemev1.31.0MIT
symfony/polyfill-intl-idnv1.31.0MIT
symfony/polyfill-intl-normalizerv1.31.0MIT
symfony/polyfill-mbstringv1.31.0MIT
symfony/service-contractsv3.5.1MIT
symfony/stopwatchv7.2.4MIT
symfony/stringv7.2.0MIT
symfony/var-exporterv7.2.4MIT
twig/twigv3.20.0BSD-3-Clause
webimpress/safe-writer2.2.0BSD-2-Clause
webmozart/assert1.11.0MIT
Contact Qodana team

Contact us at qodana-support@jetbrains.com

Comment threadsrc/Admin/src/Handler/DeleteAdminHandler.php
Comment threadsrc/Admin/src/RoutesDelegator.php Outdated
Comment threadsrc/Admin/src/RoutesDelegator.php
Comment threadsrc/Admin/src/RoutesDelegator.php Outdated
Comment threadsrc/Admin/src/RoutesDelegator.php Outdated
Comment threadsrc/Admin/src/RoutesDelegator.php Outdated
Comment threadsrc/Admin/src/RoutesDelegator.php Outdated
Comment threadsrc/Admin/src/RoutesDelegator.php Outdated
Comment threadsrc/Admin/templates/admin/list-logins.html.twig
Comment threadsrc/Admin/templates/admin/list.html.twig
@marioradu05marioradu05 linked an issue Feb 21, 2025 that may be closed by this pull request

@alexmerlinalexmerlin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extending on @arhimede's patterns, I tried to come up with a generic pattern that would fit all handlers.
See my suggestions in the below table:

ModuleVerbResourceActionExtraHandlerHandler directory/file nameRoute pathRoute name
AdminGetAdminCreateFormHandlerAdmin/GetAdminCreateFormHandler/admin/create-adminadmin::admin-create-form
AdminPostAdminCreateHandlerAdmin/PostAdminCreateHandler/admin/create-adminadmin::admin-create
AdminGetAdminEditFormHandlerAdmin/GetAdminEditFormHandler/admin/edit-admin/{uuid}admin::admin-edit-form
AdminPostAdminEditHandlerAdmin/PostAdminEditHandler/admin/edit-admin/{uuid}admin::admin-edit
AdminGetAdminDeleteFormHandlerAdmin/GetAdminDeleteFormHandler/admin/delete-admin/{uuid}admin::admin-delete-form
AdminPostAdminDeleteHandlerAdmin/PostAdminDeleteHandler/admin/delete-admin/{uuid}admin::admin-delete
AdminGetAdminListHandlerAdmin/GetAdminListHandler/admin/list-adminadmin::admin-list
AdminGetAdminLoginListHandlerAdmin/GetAdminLoginListHandler/admin/list-admin-loginadmin::admin-login-list
AdminGetAdminAccountEditFormHandlerAccount/GetAccountEditFormHandler/admin/edit-accountadmin::account-edit-form
AdminPostAdminAccountEditHandlerAccount/PostAccountEditHandler/admin/edit-accountadmin::account-edit
AdminPostAdminAccountChangePasswordHandlerAccount/PostAccountChangePasswordHandler/admin/edit-accountadmin::account-change-password
AdminGetAdminAccountLoginFormHandlerAccount/GetAccountLoginFormHandler/admin/loginadmin::admin-login-form
AdminPostAdminAccountLoginHandlerAccount/PostAccountLoginHandler/admin/loginadmin::admin-login
AdminGetAdminAccountLogoutHandlerAccount/GetAccountLogoutHandler/admin/logoutadmin::admin-logout
AppGetIndexRedirectHandlerGetIndexRedirectHandler/app::index-redirect
DashboardGetDashboardViewHandlerGetDashboardViewHandler/dashboarddashboard::dashboard-view
PageGetPageViewHandlerGetPageViewHandler/page/componentpage::components
SettingGetSettingViewHandlerGetSettingViewHandler/setting/{identifier}setting::setting-view
SettingPostSettingStoreHandlerPostSettingStoreHandler/setting/{identifier}setting::setting-store
UserGetUserCreateFormHandlerGetUserCreateFormHandler/user/create-useruser::user-create-form
UserPostUserCreateHandlerPostUserCreateHandler/user/create-useruser::user-create
UserGetUserDeleteFormHandlerGetUserDeleteFormHandler/user/delete-user/{uuid}user::user-delete-form
UserPostUserDeleteHandlerPostUserDeleteHandler/user/delete-user/{uuid}user::user-delete
UserGetUserEditFormHandlerGetUserEditFormHandler/user/edit-user/{uuid}user::user-edit-form
UserPostUserEditHandlerPostUserEditHandler/user/edit-user/{uuid}user::user-edit
UserGetUserListHandlerGetUserListHandler/user/list-useruser::user-list
UserPostUserAvatarEditHandlerPostUserAvatarEditHandler/user/edit-user-avatar/{uuid}user::user-avatar-edit

I know that introducing a few days ago the terms Resource and Collection was my idea, and now I'm dropping them, but while making the above table, they did not seem to make sense anymore.
The action View might sound MVC-ish, so if needed, it might be replaced with something more suitable.

Note that the route names also follow the same pattern:

module::resource-action-{form}

@alexmerlin

alexmerlin commented Feb 25, 2025

Copy link
Copy Markdown
Member

Maybe a more readable form of the same table from my previous comment:

image

@alexmerlin

Copy link
Copy Markdown
Member

@MarioRadu Try replacing dotkernel/dot-rbac-guard with dotkernel/dot-rbac-route-guard and let me know if you encounter any issues with the new package.

Signed-off-by: MarioRadu <magda_marior@yahoo.com>
Signed-off-by: MarioRadu <magda_marior@yahoo.com>
@arhimede

Copy link
Copy Markdown
Member

@alexmerlin please merge when you think in branch 6
will not have an V 6 release anyway

@alexmerlinalexmerlin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should rename add-admin-modal-content.html.twig to create-admin-modal-content.html.twig, just to match the naming pattern from GetAdminCreateFormHandler. (create vs add)

Or, maybe create-admin-form.html.twig?
If so, the all three *-admin-modal-content.html.twig templates should be called *-admin-form.html.twig


Let's also replace all occurrences of DotKernel with Dotkernel

Comment threadsrc/Admin/src/Controller/AdminController.php Outdated
Comment threadsrc/Setting/src/Handler/GetSettingViewHandler.php
Comment threadsrc/Admin/src/Handler/Admin/GetAdminDeleteFormHandler.php Outdated
Comment threadsrc/Admin/src/Handler/Admin/PostAdminDeleteHandler.php Outdated
Comment threadcomposer.json
Signed-off-by: MarioRadu <magda_marior@yahoo.com>

@alexmerlinalexmerlin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pagination is broken.

Comment threadsrc/App/templates/page/components.html.twig Outdated
Comment threadsrc/App/src/ConfigProvider.php Outdated
Comment threadsrc/App/templates/partial/pagination.html.twig Outdated
Comment threadsrc/App/templates/partial/pagination.html.twig
Comment threadsrc/App/templates/partial/pagination.html.twig
Comment threadsrc/App/templates/partial/pagination.html.twig Outdated
Comment threadsrc/App/templates/partial/pagination.html.twig Outdated
Comment threadsrc/App/templates/partial/pagination.html.twig Outdated
Comment threadsrc/App/templates/partial/pagination.html.twig
Signed-off-by: MarioRadu <magda_marior@yahoo.com>
Signed-off-by: MarioRadu <magda_marior@yahoo.com>
Signed-off-by: MarioRadu <magda_marior@yahoo.com>
Signed-off-by: MarioRadu <magda_marior@yahoo.com>
Signed-off-by: MarioRadu <magda_marior@yahoo.com>

@alexmerlinalexmerlin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Navigation does not reflect current page.

Signed-off-by: MarioRadu <magda_marior@yahoo.com>
Signed-off-by: MarioRadu <magda_marior@yahoo.com>
Signed-off-by: MarioRadu <magda_marior@yahoo.com>

@alexmerlinalexmerlin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Table contents are not displayed if an admin does not have column settings for a specific table.

Signed-off-by: MarioRadu <magda_marior@yahoo.com>
Signed-off-by: MarioRadu <magda_marior@yahoo.com>
Signed-off-by: MarioRadu <magda_marior@yahoo.com>
Signed-off-by: MarioRadu <magda_marior@yahoo.com>
@arhimede

Copy link
Copy Markdown
Member

thanks @MarioRadu

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Replace Controller with Handlers

3 participants

@marioradu05@alexmerlin@arhimede