From 3e0623f0db2689e183817e0d98f023f9fc9e7c83 Mon Sep 17 00:00:00 2001 From: Matteo Gallo Date: Fri, 8 May 2026 13:20:14 +0200 Subject: [PATCH] Configuration improvements --- config/oai_settings.yaml | 14 +++++++++++++- config/routes.yaml | 3 +++ src/Routing/OaiRouteLoader.php | 30 ++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 config/routes.yaml create mode 100644 src/Routing/OaiRouteLoader.php diff --git a/config/oai_settings.yaml b/config/oai_settings.yaml index 09de70b..91e2584 100644 --- a/config/oai_settings.yaml +++ b/config/oai_settings.yaml @@ -2,4 +2,16 @@ parameters: oai.repository_name: DASI OAI-PMH repository oai.base_url: http://localhost/dasi/oai oai.admin_email: info@dasiproject.eu - oai.xsl_path: 'bundles/oaisymfony/oai2.xsl' \ No newline at end of file + oai.xsl_path: 'bundles/oaisymfony/oai2.xsl' + +services: + _defaults: + autowire: true + autoconfigure: true + + OaiSymfony\Controller\: + resource: '../src/Controller/' + tags: ['controller.service_arguments'] + + OaiSymfony\Routing\OaiRouteLoader: + tags: ['routing.loader'] \ No newline at end of file diff --git a/config/routes.yaml b/config/routes.yaml new file mode 100644 index 0000000..01d5f16 --- /dev/null +++ b/config/routes.yaml @@ -0,0 +1,3 @@ +oai_routes: + resource: '../src/Controller/' + type: attribute \ No newline at end of file diff --git a/src/Routing/OaiRouteLoader.php b/src/Routing/OaiRouteLoader.php new file mode 100644 index 0000000..f4b4411 --- /dev/null +++ b/src/Routing/OaiRouteLoader.php @@ -0,0 +1,30 @@ +isLoaded) { + throw new \RuntimeException('Do not add the OaiRouteLoader twice'); + } + + $routes = $this->import(__DIR__ . '/../../config/routes.yaml', 'yaml'); + $this->isLoaded = true; + + return $routes; + } + + public function supports(mixed $resource, string $type = null): bool + { + return 'oai_symfony' === $type; + } +}