I have dynamic route: from this example
/**
* @file
* Contains \Drupal\example\Routing\ExampleRoutes.
*/
namespace Drupal\example\Routing;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
/**
* Defines dynamic routes.
*/
class ExampleRoutes {
public function routes() {
$route_collection = new RouteCollection();
$route = new Route(
// Path to attach this route to:
'/example',
// Route defaults:
array(
'_controller' => '\Drupal\example\Controller\ExampleController::content',
'_title' => 'Hello'
),
// Route requirements:
array(
'_permission' => 'access content',
)
);
// Add the route under the name 'example.content'.
$route_collection->add('example.content', $route);
return $route_collection;
}
}
the problem here is: the route is not automatically updated (or accessible) until i clear cache, then it works.
question is: how to make the new created route immediately works? *i try to avoid clear cache command (which i don't think this is the right solution)
Thanks
route_callbacks:
with service and made the correspondent services, pointing to theExampleRoutes::routes
that i show above in my questions - do i missed anything else?