Configuration improvements
This commit is contained in:
@@ -3,3 +3,15 @@ parameters:
|
|||||||
oai.base_url: http://localhost/dasi/oai
|
oai.base_url: http://localhost/dasi/oai
|
||||||
oai.admin_email: info@dasiproject.eu
|
oai.admin_email: info@dasiproject.eu
|
||||||
oai.xsl_path: 'bundles/oaisymfony/oai2.xsl'
|
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']
|
||||||
3
config/routes.yaml
Normal file
3
config/routes.yaml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
oai_routes:
|
||||||
|
resource: '../src/Controller/'
|
||||||
|
type: attribute
|
||||||
30
src/Routing/OaiRouteLoader.php
Normal file
30
src/Routing/OaiRouteLoader.php
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace OaiSymfony\Routing;
|
||||||
|
|
||||||
|
use Symfony\Component\Config\Loader\Loader;
|
||||||
|
use Symfony\Component\Routing\RouteCollection;
|
||||||
|
|
||||||
|
class OaiRouteLoader extends Loader
|
||||||
|
{
|
||||||
|
private bool $isLoaded = false;
|
||||||
|
|
||||||
|
public function load(mixed $resource, string $type = null): RouteCollection
|
||||||
|
{
|
||||||
|
if ($this->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;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user