Migrate to PHP attribute routing and cron (Maho 26.5) - #27
Merged
Conversation
Since Maho 26.5 the legacy XML `<frontend><routers>` and `<crontab>` registrations emit "Legacy XML routing" deprecation warnings into system.log on every request. Migrate to the new PHP attributes as documented at https://mahocommerce.com/routing/. - Routing: add #[Maho\Config\Route] to the 5 frontend controller actions and drop the <frontend><routers> block from config.xml. Paths are kept byte-identical (/przelewy24/payment/*, /przelewy24/webhook/*) so the reverse-lookup keys, and therefore the return/webhook URLs registered with P24, do not change. - Cron: add #[Maho\Config\CronJob] to checkPendingPayments and drop the <crontab> block. - Require maho >= 26.5.0 (attributes are not available before then) and bump the module to 3.0.0. Fixes #25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #25.
Since Maho 26.5, the legacy XML
<frontend><routers>and<crontab>registrations emit Legacy XML routing deprecation warnings intosystem.logon every request. This migrates the module to the new PHP attributes as described in https://mahocommerce.com/routing/.Changes
#[Maho\Config\Route]attributes added to the 5 frontend controller actions;<frontend><routers>removed fromconfig.xml. Paths are kept byte-identical (/przelewy24/payment/{redirect,success,cancel},/przelewy24/webhook/{transaction,refund}), so the reverse-lookup keys — and therefore the return/webhook URLs registered with Przelewy24 — do not change.#[Maho\Config\CronJob('maho_przelewy24_check_pending_payments', schedule: '*/5 * * * *')]added tocheckPendingPayments();<crontab>removed fromconfig.xml.mahocommerce/mahoconstraint raised to>=26.5.0(the attributes don't exist before 26.5); README requirement updated accordingly.2.4.0→3.0.0.<secure_url>and<translate>are intentionally left inconfig.xml(separate mechanisms, unaffected by the routing change).Verification
composer dump-autoloadcompiles all 5 routes (area: frontend) and the cron job (*/5 * * * *) intovendor/composer/maho_attributes.php; reverse-lookup keys (przelewy24/payment/redirect, …) match the existingMage::getUrl()calls, confirming generated URLs are unchanged.405handling for non-POST is preserved.php -l, PHPStan (level 8, no errors) and PHP-CS-Fixer (0 fixes) all pass.