diff --git a/composer.json b/composer.json index a8b92e0..47c4cf8 100644 --- a/composer.json +++ b/composer.json @@ -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", diff --git a/config/routes.php b/config/routes.php new file mode 100644 index 0000000..7a5e805 --- /dev/null +++ b/config/routes.php @@ -0,0 +1,14 @@ +add('nc_bulky_item_download', '/notifications/download/{voucher}') + ->controller(DownloadBulkyItemController::class) + ->requirements(['voucher' => BulkyItemStorage::VOUCHER_REGEX]) + ; +}; diff --git a/src/ContaoManager/Plugin.php b/src/ContaoManager/Plugin.php index 64257a6..b05fc5e 100644 --- a/src/ContaoManager/Plugin.php +++ b/src/ContaoManager/Plugin.php @@ -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') ; } } diff --git a/src/Controller/DownloadBulkyItemController.php b/src/Controller/DownloadBulkyItemController.php index 8cf37ab..0a2e652 100644 --- a/src/Controller/DownloadBulkyItemController.php +++ b/src/Controller/DownloadBulkyItemController.php @@ -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(