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; + } +}