Skip to content

Commit

Permalink
Fix route loading in Contao 4.13 (#379)
Browse files Browse the repository at this point in the history
  • Loading branch information
aschempp authored Nov 26, 2024
1 parent dda5fb1 commit d3dccef
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"php": "^8.1",
"composer-plugin-api": "^2.0",
"codefog/contao-haste": "^5.2",
"contao/core-bundle": "^4.13.50 || ^5.3.14 || ^5.4.4",
"contao/core-bundle": "^4.13.50 || ~5.3.14 || ^5.4.4",
"doctrine/dbal": "^3.4",
"doctrine/orm": "^2.19",
"knplabs/knp-menu": "^3.1",
Expand Down
14 changes: 14 additions & 0 deletions config/routes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

declare(strict_types=1);

use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
use Terminal42\NotificationCenterBundle\BulkyItem\BulkyItemStorage;
use Terminal42\NotificationCenterBundle\Controller\DownloadBulkyItemController;

return static function (RoutingConfigurator $routes): void {
$routes->add('nc_bulky_item_download', '/notifications/download/{voucher}')
->controller(DownloadBulkyItemController::class)
->requirements(['voucher' => BulkyItemStorage::VOUCHER_REGEX])
;
};
4 changes: 2 additions & 2 deletions src/ContaoManager/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ public function getBundles(ParserInterface $parser): array
public function getRouteCollection(LoaderResolverInterface $resolver, KernelInterface $kernel)
{
return $resolver
->resolve(__DIR__.'/../Controller/DownloadBulkyItemController.php', 'attribute')
->load(__DIR__.'/../Controller/DownloadBulkyItemController.php')
->resolve(__DIR__.'/../../config/routes.php')
->load(__DIR__.'/../../config/routes.php')
;
}
}
2 changes: 0 additions & 2 deletions src/Controller/DownloadBulkyItemController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@
use Symfony\Component\HttpFoundation\UriSigner as HttpFoundationUriSigner;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\HttpKernel\UriSigner as HttpKernelUriSigner;
use Symfony\Component\Routing\Attribute\Route;
use Terminal42\NotificationCenterBundle\BulkyItem\BulkyItemStorage;

#[Route('/notifications/download/{voucher}', 'nc_bulky_item_download', requirements: ['voucher' => BulkyItemStorage::VOUCHER_REGEX])]
class DownloadBulkyItemController
{
public function __construct(
Expand Down

0 comments on commit d3dccef

Please sign in to comment.