How to import external routes in Akeneo 4.0

I’m building a custom bundle for Akeneo v4.0. I’m trying to import routes from that bundle to the rest of the app. So far I’ve done:

# config/bundles.php
<?php

return [
    JBieliauskasMyServerBundleMyServerBundle::class => ['dev' => true, 'test' => true],
];
# src/MyServerBundle/Resources/config/routing.yml
my_server_index:
  path: /my-server
# config/routes/routes.yml
jb_my_server:
  resource: "@MyServerBundle/Resources/config/routing.yml"
  prefix: /

Then I run:

$ bin/console cache:clear
$ bin/console debug:router | grep my_server

and nothing shows up. What am I missing?

I know that src/Kernel.php is looking for routes using a glob pattern, but I don’t understand it:

protected function configureRoutes(RouteCollectionBuilder $routes): void 
{
    // ...
    $this->loadRoutesConfiguration($routes, $this->getProjectDir() . '/config', $this->environment);
}

// ...

private function loadRoutesConfiguration(RouteCollectionBuilder $routes, string $confDir, string $environment): void
{
    // ...
    $routes->import($confDir . '/{routes}/*.yml', '/', 'glob');
}

So it should detect the file config/routes/routes.yml, no?

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *