Skip to content

Migrate to PHP attribute routing and cron (Maho 26.5) - #27

Merged
fballiano merged 1 commit into
mainfrom
fix/issue-25-attribute-routing
Jun 9, 2026
Merged

Migrate to PHP attribute routing and cron (Maho 26.5)#27
fballiano merged 1 commit into
mainfrom
fix/issue-25-attribute-routing

Conversation

@fballiano

Copy link
Copy Markdown
Contributor

Fixes #25.

Since Maho 26.5, the legacy XML <frontend><routers> and <crontab> registrations emit Legacy XML routing deprecation warnings into system.log on every request. This migrates the module to the new PHP attributes as described in https://mahocommerce.com/routing/.

Changes

  • Routing#[Maho\Config\Route] attributes added to the 5 frontend controller actions; <frontend><routers> removed from config.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.
  • Cron#[Maho\Config\CronJob('maho_przelewy24_check_pending_payments', schedule: '*/5 * * * *')] added to checkPendingPayments(); <crontab> removed from config.xml.
  • Dependencymahocommerce/maho constraint raised to >=26.5.0 (the attributes don't exist before 26.5); README requirement updated accordingly.
  • Version — module bumped 2.4.03.0.0.

<secure_url> and <translate> are intentionally left in config.xml (separate mechanisms, unaffected by the routing change).

Verification

  • composer dump-autoload compiles all 5 routes (area: frontend) and the cron job (*/5 * * * *) into vendor/composer/maho_attributes.php; reverse-lookup keys (przelewy24/payment/redirect, …) match the existing Mage::getUrl() calls, confirming generated URLs are unchanged.
  • Webhook routes leave HTTP methods unrestricted so the controllers' own 405 handling for non-POST is preserved.
  • php -l, PHPStan (level 8, no errors) and PHP-CS-Fixer (0 fixes) all pass.

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
@fballiano
fballiano merged commit a4f1f79 into main Jun 9, 2026
10 checks passed
@fballiano
fballiano deleted the fix/issue-25-attribute-routing branch June 9, 2026 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Maho 26.5 Routing

1 participant