Hallo,
ich habe einen DynamicRouteLoader programmiert und in der services.yaml registriert. Das hier sind die Dateien die für das Laden relavent sind:
services.yaml
Code:
services:
_defaults:
autowire: true
autoconfigure: true
Bits\IsoProductfeed\Routing\DynamicRouteLoader:
arguments:
$resourceResolver: '@Bits\IsoProductfeed\Service\ResourceResolver'
$defaultFileName: 'default.xml'
tags: ['routing.loader']
bundles.php
PHP-Code:
<?php
// config/bundles.php
return [
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Symfony\Bundle\RoutingBundle\RoutingBundle::class => ['all' => true],
Contao\CoreBundle\ContaoCoreBundle::class => ['all' => true]
];
Plugin.php
PHP-Code:
<?php
namespace Bits\IsoProductfeed\ContaoManager;
use Contao\ManagerPlugin\Bundle\BundlePluginInterface;
use Contao\ManagerPlugin\Bundle\Config\BundleConfig;
use Contao\ManagerPlugin\Bundle\Parser\ParserInterface;
use Contao\CoreBundle\ContaoCoreBundle;
use Bits\IsoProductfeed\IsoProductfeedBundle;
use Symfony\Bundle\TwigBundle\TwigBundle;
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
use Symfony\Bundle\RoutingBundle\RoutingBundle;
use Contao\ManagerPlugin\Routing\RoutingPluginInterface;
use Symfony\Component\Config\Loader\LoaderResolverInterface;
use Symfony\Component\HttpKernel\KernelInterface;
class Plugin implements BundlePluginInterface, RoutingPluginInterface
{
/**
* Registers the IsoProductfeedBundle and specifies dependencies.
*/
public function getBundles(ParserInterface $parser): array
{
return [
BundleConfig::create(IsoProductfeedBundle::class)
->setLoadAfter([ContaoCoreBundle::class, 'isotope',TwigBundle::class,FrameworkBundle::class,RoutingBundle::class]), // Load after Contao Core and Isotope
];
}
/**
* Loads the route collection for the bundle.
*/
public function getRouteCollection(LoaderResolverInterface $resolver, KernelInterface $kernel)
{
return $resolver
->resolve(__DIR__ . '/../Resources/config/routes.yaml', 'yaml')
->load(__DIR__ . '/../Resources/config/routes.yaml');
}
}
Mit diesen Konsole-Befehl kann ich sehen das es nicht geladen wird:
Code:
php vendor/bin/contao-console debug:container --tag=routing.loader
Hat Jemand eine Idee was noch fehlt oder was daran falsch ist?
Achso, vielleicht noch meine routes.yaml
Code:
dynamic_routing:
resource: '.'
type: dynamic